o
    vy‚id  ã                   @   sL   d dl mZmZmZ d dlmZ G dd„ deƒZG dd„ deƒZdd„ Z	d	S )
é    )ÚAnyÚDictÚOptional)Ú	BaseModelc                   @   sH   e Zd ZU dZee ed< 	 ee ed< 	 ee ed< 	 ee ed< dS )ÚAPIErrorFromJSONzT
    A pydantic object to validate an error info object
    from a json string.
    ÚmessageÚcodeÚhintÚdetailsN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   ÚstrÚ__annotations__© r   r   úW/home/ubuntu/maya3_transcribe/venv/lib/python3.10/site-packages/postgrest/exceptions.pyr      s   
 r   c                   @   s˜   e Zd ZU dZeeef ed< ee ed< 	 ee ed< 	 ee ed< 	 ee ed< 	 deeef dd	fd
d„Z	defdd„Z
deeef fdd„Zd	S )ÚAPIErrorz,
    Base exception for all API errors.
    Ú
_raw_errorr   r   r	   r
   ÚerrorÚreturnNc                 C   sJ   || _ | d¡| _| d¡| _| d¡| _| d¡| _t | t| ƒ¡ d S )Nr   r   r	   r
   )	r   Úgetr   r   r	   r
   Ú	ExceptionÚ__init__r   )Úselfr   r   r   r   r   %   s   zAPIError.__init__c                 C   sv   | j r
d| j › dnd}| jrd| j› nd}| jr d| j› nd}| jr+d| j› nd}|› |› |› |› }|p:dS )NzError ú:Ú z

Message: z
Hint: z

Details: zEmpty error)r   r   r	   r
   )r   Ú
error_textÚmessage_textÚ	hint_textÚdetails_textÚcomplete_error_textr   r   r   Ú__repr__-   s   zAPIError.__repr__c                 C   s   | j S )zYConvert the error into a dictionary.

        Returns:
            :class:`dict`
        )r   )r   r   r   r   Újson5   s   zAPIError.json)r   r   r   r   r   r   r   r   r   r   r"   r#   r   r   r   r   r      s   
 r   c                 C   s   d| j dt| jƒdœS )NzJSON could not be generatedz!Refer to full message for details)r   r   r	   r
   )Ústatus_coder   Úcontent)Úrr   r   r   Úgenerate_default_error_message>   s
   ür'   N)
Útypingr   r   r   Úpydanticr   r   r   r   r'   r   r   r   r   Ú<module>   s
    (