o
    b                     @   s0   d dl mZ G dd deZG dd deZdS )    default_json_headersc                       s6   e Zd ZdZdZdZdZd fdd	Zdd Z  Z	S )	AuthlibBaseErrorz)Base Exception for all errors in Authlib.N c                    sN   |d ur|| _ |d ur|| _|d ur|| _d| j | j}tt| | d S )Nz{}: {})errordescriptionuriformatsuperr   __init__)selfr   r   r   message	__class__ T/var/www/secure340b-portal/env/lib/python3.10/site-packages/authlib/common/errors.pyr      s   zAuthlibBaseError.__init__c                 C   s   d | jj| jS )Nz	<{} "{}">)r	   r   __name__r   r   r   r   r   __repr__   s   zAuthlibBaseError.__repr__)NNN)
r   
__module____qualname____doc__r   r   r   r   r   __classcell__r   r   r   r   r      s    r   c                       sX   e Zd ZdZ		d fdd	Zdd Zdd Zd	d
 Zdd Zdd Z	dddZ
  ZS )AuthlibHTTPErrori  Nc                    s2   t t| ||| |d ur|| _d | _d | _d S N)r
   r   r   status_code_translations_error_uris)r   r   r   r   r   r   r   r   r   "   s
   
zAuthlibHTTPError.__init__c                 C   s   | j r	| j |S |S r   )r   gettext)r   sr   r   r   r   *   s   zAuthlibHTTPError.gettextc                 C   s   | j S r   )r   r   r   r   r   get_error_description/   s   z&AuthlibHTTPError.get_error_descriptionc                 C   s$   | j r| j S | jr| j| jS d S r   )r   r   getr   r   r   r   r   get_error_uri2   s
   zAuthlibHTTPError.get_error_uric                 C   sD   d| j fg}|  }|r|d|f |  }|r |d|f |S )Nr   Zerror_descriptionZ	error_uri)r   r    appendr"   )r   r   r   r   r   r   r   get_body8   s   zAuthlibHTTPError.get_bodyc                 C   s   t d d  S r   r   r   r   r   r   get_headersD   s   zAuthlibHTTPError.get_headersc                 C   s,   || _ || _t|  }|  }| j||fS r   )r   r   dictr$   r%   r   )r   ZtranslationsZ
error_urisbodyheadersr   r   r   __call__G   s
   zAuthlibHTTPError.__call__)NNNN)NN)r   r   r   r   r   r   r    r"   r$   r%   r)   r   r   r   r   r   r      s    r   N)Zauthlib.constsr   	Exceptionr   r   r   r   r   r   <module>   s   