
    
FZjj	                     J    d Z  G d de      Z G d de      Z G d de      Zy)zQ
mygeotab.exceptions
~~~~~~~~~~~~~~~~~~~

Exceptions thrown by the MyGeotab API.
c                   (     e Zd ZdZ fdZd Z xZS )MyGeotabExceptionz0There was an exception while handling your call.c                     || _         |d   d   }|d   | _        |d   | _        |j                  d      | _        |j                  d      | _        t        t        | "  | j                  g|i | y)zInitialize MyGeotabException with the full error from the server.

        :param full_error: The full JSON-decoded error.
        errors    namemessagedata
stackTraceN)	_full_errorr   r   getr	   stack_tracesuperr   __init__)self
full_errorargskwargs
main_error	__class__s        UC:\Users\Rodrigo\frota-trucks-cliente\python\Lib\site-packages\mygeotab/exceptions.pyr   zMyGeotabException.__init__   ss    
 &)!,
v&	!),NN6*	%>>,7/NtNvN    c                     dj                  | j                  | j                        }| j                  r|dj                  | j                        z  }|S )Nz{0}
{1}z

Stacktrace:
{0})formatr   r   r   )r   	error_strs     r   __str__zMyGeotabException.__str__   sG    %%dii>	/66t7G7GHHIr   )__name__
__module____qualname____doc__r   r   __classcell__r   s   @r   r   r      s    :Or   r   c                   8     e Zd ZdZ fdZd Zed        Z xZS )AuthenticationExceptionz,Unsuccessful authentication with the server.c                 r    || _         || _        || _        t        t        |   | j                  g|i | y)a  Initialize AuthenticationException with username, database, and server.

        :param username: The username used for MyGeotab servers. Usually an email address.
        :param database: The database or company name.
        :param server: The server ie. my23.geotab.com.
        N)usernamedatabaseserverr   r#   r   r   )r   r%   r&   r'   r   r   r   s         r   r   z AuthenticationException.__init__%   s8     ! %t5dllTTTVTr   c                     | j                   S Nr   r   s    r   r   zAuthenticationException.__str__1       ||r   c                 d    dj                  | j                  | j                  | j                        S )zThe exception message.z#Cannot authenticate '{0} @ {1}/{2}')r   r%   r'   r&   r+   s    r   r   zAuthenticationException.message4   s(     5;;DMM4;;X\XeXeffr   	r   r   r   r   r   r   propertyr   r    r!   s   @r   r#   r#   "   s'    6
U g gr   r#   c                   8     e Zd ZdZ fdZd Zed        Z xZS )TimeoutExceptionz2The request timed out while handling your request.c                 V    || _         t        t        |   | j                  g|i | y)zrInitialize TimeoutException with the server name.

        :param server: The server ie. my23.geotab.com.
        N)r'   r   r1   r   r   )r   r'   r   r   r   s       r   r   zTimeoutException.__init__=   s*    
 .t||MdMfMr   c                     | j                   S r)   r*   r+   s    r   r   zTimeoutException.__str__E   r,   r   c                 8    dj                  | j                        S )zThe excepton message.zRequest timed out @ {0})r   r'   r+   s    r   r   zTimeoutException.messageH   s     )//<<r   r.   r!   s   @r   r1   r1   :   s%    <N = =r   r1   N)r   IOErrorr   r#   r1    r   r   <module>r7      s0    .gg g0=w =r   