
    =hJ                     D    d dl Z d dlmZ  G d de      Z G d de      Zy)    N)Optionalc                       e Zd Zy)TwilioExceptionN)__name__
__module____qualname__     f/var/www/html/phonemate/phone_mate_backend/venv/lib/python3.12/site-packages/twilio/base/exceptions.pyr   r      s    r
   r   c                   R    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	y)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statusurimsgcodemethoddetailsc                 X    || _         || _        || _        || _        || _        || _        y )N)r   r   r   r   r   r   )selfr   r   r   r   r   r   s          r   __init__zTwilioRestException.__init__   s.     	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                  j                         rd
j                   |d       |d       || j                  d| j                         |d       |t        | j                                    }| j                  r@dj                  |dj                   |d       | || j                                    g      }|S dj                  | 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j                  |       S )Nz&https://www.twilio.com/docs/errors/{0})format)r   s    r   get_uriz,TwilioRestException.__str__.<locals>.get_uri5   s    ;BB4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message 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__&   sI   	7s 	7s 	7	7 	7 	7	7 	7 	7	7 	7 	7	I# 	I# 	I 3::x(SZZ->->-@77=v!,/ %&9 :"dkk488#DE$)*V$W TXX/ 8> 8  yygg4;;&+,U&V $WTYY%7 8 <  J(//TXXFFr
   )r.   NGETN)
r   r   r   __doc__r1   r0   r   objectr   r6   r	   r
   r   r   r   
   sk    	 "$(  	
 sm  &! ,G ,Gr
   r   )r3   typingr   	Exceptionr   r   r	   r
   r   <module>r<      s'    
 	i 	HG/ HGr
   