
    bfJ                     R    d dl Z d dlmZ  G d de          Z G d de          ZdS )    N)Optionalc                       e Zd ZdS )TwilioExceptionN)__name__
__module____qualname__     P/var/www/html/Alfredo/env/lib/python3.11/site-packages/twilio/base/exceptions.pyr   r      s        Dr
   r   c                   `    e Zd ZdZ	 	 	 	 ddedededee         d	ed
ee         fdZdef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                 Z    || _         || _        || _        || _        || _        || _        d S )N)r   r   r   r   r   r   )selfr   r   r   r   r   r   s          r   __init__zTwilioRestException.__init__   s2     	r
   returnc                    dt           dt           fd}dt           dt           fd}dt           dt           fd}dt           dt           fd}dt          dt           fd}t          t          j        d	          rt          j                                        rd
                     |d           |d           || j        d| j                   |d           |t          | j	                                      }| j
        rLd                    |d                     |d           | || j
                                      g          }|S d                    | j        | j	                  S )z>Try to pretty-print the exception, if this is going on screen.wordsr   c                     d| z  S )Nz[31m[49m%s[0mr	   r   s    r   redz(TwilioRestException.__str__.<locals>.red)       .66r
   c                     d| z  S )Nz[37m[49m%s[0mr	   r   s    r   whitez*TwilioRestException.__str__.<locals>.white,   r   r
   c                     d| z  S )Nz[34m[49m%s[0mr	   r   s    r   bluez)TwilioRestException.__str__.<locals>.blue/   r   r
   c                     d| z  S )Nz[36m[49m%s[0mr	   r   s    r   tealz)TwilioRestException.__str__.<locals>.teal2   r   r
   r   c                 ,    d                     |           S )Nz&https://www.twilio.com/docs/errors/{0})format)r   s    r   get_uriz,TwilioRestException.__str__.<locals>.get_uri5   s    ;BB4HHHr
   isattyzF
{red_error} {request_was}

{http_line}

{twilio_returned}

{message}
z
HTTP ErrorzYour request was: z*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   s          r   __str__zTwilioRestException.__str__&   s   	7s 	7s 	7 	7 	7 	7	7 	7 	7 	7 	7 	7	7 	7 	7 	7 	7 	7	7 	7 	7 	7 	7 	7	I# 	I# 	I 	I 	I 	I 3:x(( 	GSZ->->-@-@ 	G77=v!c,// %&9 : :"ddkkk488#DEE$)E*V$W$W DTX// 8> 8 8  y 	gg4;;&+e,U&V&V $WWTY%7%7 8 8 <    J(//TXFFFr
   )r   Nr   N)
r   r   r   __doc__r2   r1   r   objectr   r7   r	   r
   r   r   r   
   s        	 	 "$(   	
 sm  &!    ,G ,G ,G ,G ,G ,G ,Gr
   r   )r4   typingr   	Exceptionr   r   r	   r
   r   <module>r<      s    



      	 	 	 	 	i 	 	 	HG HG HG HG HG/ HG HG HG HG HGr
   