o
    / hæ  ã                   @   s,   d dl mZmZ G dd„ deƒZdd„ ZdS )é    )ÚDictÚOptionalc                   @   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_errorÚmessageÚcodeÚhintÚdetailsÚerrorÚreturnNc                 C   sJ   || _ | d¡| _| d¡| _| d¡| _| d¡| _t | t| ƒ¡ d S )Nr   r   r   r	   )	r   Úgetr   r   r   r	   Ú	ExceptionÚ__init__Ústr)Úselfr
   © r   úM/var/www/html/govbot/env/lib/python3.10/site-packages/postgrest/exceptions.pyr      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   Újson#   s   zAPIError.json)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   Ú__annotations__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   r   r$   r   r   r   r   Ú<module>   s    (