o
    4gJ                     @   s8   d dl Z d dlmZ G dd deZG dd deZdS )    N)Optionalc                   @   s   e Zd ZdS )TwilioExceptionN)__name__
__module____qualname__ r   r   b/var/www/html/Testing_prj/Navya-Bakers/venv/lib/python3.10/site-packages/twilio/base/exceptions.pyr      s    r   c                   @   sR   e Zd ZdZ				ddedededee d	ed
ee fddZdefddZ	dS )TwilioRestExceptiona  A generic 400 or 500 level exception from the Twilio API

    :param int status: the HTTP status that was returned for the exception
    :param str uri: The URI that caused the exception
    :param str msg: A human-readable message for the error
    :param int|None code: A Twilio-specific error code for the error. This is
         not available for all errors.
    :param method: The HTTP method used to make the request
    :param details: Additional error details returned for the exception
     NGETstatusurimsgcodemethoddetailsc                 C   s(   || _ || _|| _|| _|| _|| _d S )N)r   r   r   r   r   r   )selfr   r   r   r   r   r   r   r   r   __init__   s   	
zTwilioRestException.__init__returnc                 C   s   dt dt fdd}dt dt fdd}dt dt fdd}dt dt fd	d
}dtdt fdd}ttjdrmtj rmdj|d|d|d| j| jf |d|t | j	d}| j
rkd|dj|d||| j
dg}|S d| j| j	S )z>Try to pretty-print the exception, if this is going on screen.wordsr   c                 S      d|  S )Nz[31m[49m%s[0mr   r   r   r   r   red)      z(TwilioRestException.__str__.<locals>.redc                 S   r   )Nz[37m[49m%s[0mr   r   r   r   r   white,   r   z*TwilioRestException.__str__.<locals>.whitec                 S   r   )Nz[34m[49m%s[0mr   r   r   r   r   blue/   r   z)TwilioRestException.__str__.<locals>.bluec                 S   r   )Nz[36m[49m%s[0mr   r   r   r   r   teal2   r   z)TwilioRestException.__str__.<locals>.tealr   c                 S   s
   d | S )Nz&https://www.twilio.com/docs/errors/{0})format)r   r   r   r   get_uri5   s   
z,TwilioRestException.__str__.<locals>.get_uriisattyzF
{red_error} {request_was}

{http_line}

{twilio_returned}

{message}
z
HTTP ErrorzYour request was:z%s %sz*Twilio returned the following information:)	red_errorrequest_was	http_linetwilio_returnedmessager
   z
{more_info}

{uri}

z'More information may be available here:)	more_infor   zHTTP {0} error: {1})strinthasattrsysstderrr   r   r   r   r   r   joinr   )r   r   r   r   r   r   r   r   r   r   __str__&   s4   
	zTwilioRestException.__str__)r
   Nr   N)
r   r   r   __doc__r'   r&   r   objectr   r,   r   r   r   r   r	   
   s(    
r	   )r)   typingr   	Exceptionr   r	   r   r   r   r   <module>   s   