o
    g,                     @   s   d Z ddlmZ G dd deZG dd deZG dd deZG d	d
 d
eZG dd deZG dd deZ	G dd deZ
G dd deZG dd deZG dd deZG dd deZdS )z$All exceptions for Simple Salesforce    )Unionc                   @   sT   e Zd ZU dZdZeed< dedededefdd	Z	d
efddZ
d
efddZdS )SalesforceErrorzBase Salesforce API exceptionz=Unknown error occurred for {url}. Response content: {content}messageurlstatusresource_namecontentc                 C   s   || _ || _|| _|| _dS )aj  Initialize the SalesforceError exception

        SalesforceError is the base class of exceptions in simple-salesforce

        Args:
            url: Salesforce URL that was called
            status: Status code of the error response
            resource_name: Name of the Salesforce resource being queried
            content: content of the response
        N)r   r   r   r   )selfr   r   r   r    r
   U/home/ubuntu/webapp/venv/lib/python3.10/site-packages/simple_salesforce/exceptions.py__init__   s   
zSalesforceError.__init__returnc                 C      | j j| j| jdS )N)r   r   )r   formatr   r   r	   r
   r
   r   __str__#      zSalesforceError.__str__c                 C   s   |   S N)r   r   r
   r
   r   __unicode__&   s   zSalesforceError.__unicode__N)__name__
__module____qualname____doc__r   str__annotations__intbytesr   r   r   r
   r
   r
   r   r      s   
 

r   c                   @      e Zd ZdZdZdS )SalesforceMoreThanOneRecordz
    Error Code: 300
    The value returned when an external ID exists in more than one record. The
    response body contains the list of matching records.
    z;More than one record for {url}. Response content: {content}Nr   r   r   r   r   r
   r
   r
   r   r   *       r   c                   @   r   )SalesforceMalformedRequestz}
    Error Code: 400
    The request couldn't be understood, usually because the JSON or XML body
    contains an error.
    z4Malformed request {url}. Response content: {content}Nr   r
   r
   r
   r   r!   4   r    r!   c                   @   r   )SalesforceExpiredSessionz
    Error Code: 401
    The session ID or OAuth token used has expired or is invalid. The response
    body contains the message and errorCode.
    z6Expired session for {url}. Response content: {content}Nr   r
   r
   r
   r   r"   >   r    r"   c                   @   r   )SalesforceRefusedRequestz{
    Error Code: 403
    The request has been refused. Verify that the logged-in user has
    appropriate permissions.
    z6Request refused for {url}. Response content: {content}Nr   r
   r
   r
   r   r#   H   r    r#   c                   @   "   e Zd ZdZdZdefddZdS )SalesforceResourceNotFoundz
    Error Code: 404
    The requested resource couldn't be found. Check the URI for errors, and
    verify that there are no sharing issues.
    z6Resource {name} Not Found. Response content: {content}r   c                 C   r   )N)namer   )r   r   r   r   r   r
   r
   r   r   [   s   
z"SalesforceResourceNotFound.__str__Nr   r   r   r   r   r   r   r
   r
   r
   r   r%   R   s    r%   c                   @   s:   e Zd ZdZdeeedf defddZdefdd	ZdS )
SalesforceAuthenticationFailedzH
    Thrown to indicate that authentication with Salesforce failed.
    codeNr   c                 C   s   || _ || _d S r   r)   r   )r	   r)   r   r
   r
   r   r   e   s   
z'SalesforceAuthenticationFailed.__init__r   c                 C   s   | j  d| j S )Nz: r*   r   r
   r
   r   r   p   s   z&SalesforceAuthenticationFailed.__str__)	r   r   r   r   r   r   r   r   r   r
   r
   r
   r   r(   `   s    
r(   c                   @   r$   )SalesforceGeneralErrorz*
    A non-specific Salesforce error.
    z0Error Code {status}. Response content: {content}r   c                 C   r   )N)r   r   )r   r   r   r   r   r
   r
   r   r   {   r   zSalesforceGeneralError.__str__Nr'   r
   r
   r
   r   r+   t   s    r+   c                   @      e Zd ZdZdS )SalesforceOperationErrorz&Base error for Bulk API 2.0 operationsNr   r   r   r   r
   r
   r
   r   r-          r-   c                   @   r,   )SalesforceBulkV2LoadErrorz-
    Error occurred during bulk 2.0 load
    Nr.   r
   r
   r
   r   r0      r/   r0   c                   @   r,   )SalesforceBulkV2ExtractErrorz0
    Error occurred during bulk 2.0 extract
    Nr.   r
   r
   r
   r   r1      r/   r1   N)r   typingr   	Exceptionr   r   r!   r"   r#   r%   r(   r+   r-   r0   r1   r
   r
   r
   r   <module>   s    %



