
    g                     0    d dl mZmZ  G d de      Zd Zy)    )DictOptionalc                       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
ZdefdZ	deeef   fdZ
y	)APIErrorz,
    Base exception for all API errors.
    
_raw_errormessagecodehintdetailserrorreturnNc                     || _         |j                  d      | _        |j                  d      | _        |j                  d      | _        |j                  d      | _        t        j                  | t        |              y )Nr   r	   r
   r   )	r   getr   r	   r
   r   	Exception__init__str)selfr   s     I/var/www/openai/venv/lib/python3.12/site-packages/postgrest/exceptions.pyr   zAPIError.__init__   s]    yy+IIf%	IIf%	yy+4T+    c                    | 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}| | | | }|xs 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_texts         r   __repr__zAPIError.__repr__   s    .2iivdii[*R
7;||T\\N3.2iihtyyk*R	7;||T\\N3!+\N9+l^T"3m3r   c                     | j                   S )zYConvert the error into a dictionary.

        Returns:
            :class:`dict`
        )r   )r   s    r   jsonzAPIError.json#   s     r   )__name__
__module____qualname____doc__r   r   __annotations__r   r   r   r     r   r   r   r      s     S#Xc]
3-
3-c],d38n , ,4# 4d38n r   r   c                 J    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)rs    r   generate_default_error_messager+   ,   s$    03qyy>	 r   N)typingr   r   r   r   r+   r&   r   r   <module>r-      s    !%y %Pr   