o
    j                     @   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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\The ``spyne.error`` module contains various common exceptions that the user
code can throw.
    )Faultc                       s.   e Zd ZdZdZdZedf fdd	Z  ZS )InvalidCredentialsErrorz,Raised when requested resource is forbidden.zClient.InvalidCredentialsErrorz3You do not have permission to access this resource.Nc                    s   t t| j| j||d d S )N)detail)superr   __init__CODE)selffault_stringparams	__class__ K/var/www/html/LicenciasMiG/venv/lib/python3.10/site-packages/spyne/error.pyr   "   s   

z InvalidCredentialsError.__init__)__name__
__module____qualname____doc__r   STRr   __classcell__r   r   r   r   r      s
    r   c                       &   e Zd ZdZdZd fdd	Z  ZS )RequestTooLongErrorz Raised when request is too long.zClient.RequestTooLongRequest too longc                       t t| | j| d S N)r   r   r   r   r   faultstringr   r   r   r   ,      zRequestTooLongError.__init__)r   r   r   r   r   r   r   r   r   r   r   r   r   '       r   c                       r   )RequestNotAllowedz"Raised when request is incomplete.zClient.RequestNotAllowed c                    r   r   )r   r   r   r   r   r   r   r   r   5   r   zRequestNotAllowed.__init__r    r   r   r   r   r   r   0   r   r   c                       r   )ArgumentError7Raised when there is a general problem with input data.zClient.ArgumentErrorr    c                    r   r   )r   r"   r   r   r   r   r   r   r   >   r   zArgumentError.__init__r!   r   r   r   r   r   r"   9   r   r"   c                       s"   e Zd ZdZd fdd	Z  ZS )InvalidInputErrorr#   r    c                    s   t t| dt||f d S )NClient.InvalidInput)r   r$   r   repr)r   r   datar   r   r   r   E   s   zInvalidInputError.__init__)r    r    )r   r   r   r   r   r   r   r   r   r   r$   B   s    r$   c                       r   )MissingFieldErrorz)Raised when a mandatory value is missing.r%   Field '%s' is missing.c                    s:   z||f }W n	 t y   Y nw tt| | j| d S r   )	TypeErrorr   r(   r   r   )r   
field_namemessager   r   r   r   R   s   zMissingFieldError.__init__)r)   r   r   r   r   r   r(   M   r   r(   c                       r   )ValidationErrorzARaised when the input stream does not adhere to type constraints.zClient.ValidationError$The value %r could not be validated.c                    s>   z||f }W n t y   |}Y nw tt| | j| d S r   )r*   r   r-   r   r   )r   obj
custom_msgmsgr   r   r   r   `   s   zValidationError.__init__)r.   r   r   r   r   r   r-   [   r   r-   c                       s$   e Zd ZdZdZ fddZ  ZS )InternalErrorz)Raised to communicate server-side errors.Serverc                    s   t t| | jd d S )Nz,InternalError: An unknown error has occured.)r   r2   r   r   )r   errorr   r   r   r   n   s   zInternalError.__init__r   r   r   r   r   r2   i   s    r2   c                       s(   e Zd ZdZdZ	d fdd	Z  ZS )ResourceNotFoundErrorz,Raised when requested resource is not found.zClient.ResourceNotFoundRequested resource %r not foundc                    s   t t| | j||f  d S r   )r   r5   r   r   r   fault_objectr	   r   r   r   r   x   s   zResourceNotFoundError.__init__)r6   r   r   r   r   r   r5   s   s
    r5   c                   @   s   e Zd ZdS )RespawnErrorN)r   r   r   r   r   r   r   r9   ~   s    r9   c                       r   )ResourceAlreadyExistsErrorz=Raised when requested resource already exists on server side.zClient.ResourceAlreadyExistsResource %r already existsc                    s   t t| | j||  d S r   )r   r:   r   r   r7   r   r   r   r      s   z#ResourceAlreadyExistsError.__init__)r;   r   r   r   r   r   r:      r   r:   c                       s.   e Zd ZdZdZd fdd	Zdd Z  ZS )	RedirectzKRaised when client needs to make another request for the same
    resource.zClient.RedirectNc                    s,   t t| j| j|d || _|| _|| _d S )N)r   )r   r<   r   r   ctxlocationorig_exc)r   r=   r>   r?   r   r   r   r      s   
zRedirect.__init__c                 C   s   t  r   )NotImplementedError)r   r   r   r   do_redirect   s   zRedirect.do_redirectr   )r   r   r   r   r   r   rA   r   r   r   r   r   r<      s
    r<   N)r   spyne.model.faultr   r   r   r   r"   r$   InvalidRequestErrorr(   r-   r2   r5   r9   r:   r<   r   r   r   r   <module>   s   			

