o
    ޭh                     @  s4  d dl mZ d dlmZmZ er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eZG dd deZG dd deZG dd deeZG d d! d!eZG d"d# d#eZd$S )%    )annotations)TYPE_CHECKINGAny)Modelc                   @     e Zd ZdZdS )BaseORMExceptionz
    Base ORM Exception.
    N__name__
__module____qualname____doc__ r   r   X/var/www/html/stock_analysis/be/venv/lib/python3.10/site-packages/tortoise/exceptions.pyr   	       r   c                   @  r   )
FieldErrorzX
    The FieldError exception is raised when there is a problem with a model field.
    Nr   r   r   r   r   r      r   r   c                   @  r   )ParamsErrorzV
    The ParamsError is raised when function can not be run with given parameters
    Nr   r   r   r   r   r      r   r   c                   @  r   )ConfigurationErrorzb
    The ConfigurationError exception is raised when the configuration of the ORM is invalid.
    Nr   r   r   r   r   r      r   r   c                   @  r   )TransactionManagementErrorzU
    The TransactionManagementError is raised when any transaction error occurs.
    Nr   r   r   r   r   r   !   r   r   c                   @  r   )OperationalErrorzT
    The OperationalError exception is raised when an operational error occurs.
    Nr   r   r   r   r   r   '   r   r   c                   @  r   )IntegrityErrorzR
    The IntegrityError exception is raised when there is an integrity error.
    Nr   r   r   r   r   r   -   r   r   c                   @  r   )NoValuesFetchedz[
    The NoValuesFetched exception is raised when the related model was never fetched.
    Nr   r   r   r   r   r   3   r   r   c                      s0   e Zd ZdZd fddZd fd	d
Z  ZS )NotExistOrMultiple modeltype[Model] | strreturnNonec                   s2   d | _ t|tr|f| }n|| _ t j|  d S N)r   
isinstancestrsuper__init__)selfr   args	__class__r   r   r!   <   s
   
zNotExistOrMultiple.__init__r   c                   s$   | j d u r
t  S | j| j jS r   )r   r    __str__TEMPLATEformatr	   r"   r$   r   r   r&   D   s   

zNotExistOrMultiple.__str__)r   r   r   r   r   r   )r	   r
   r   r'   r!   r&   __classcell__r   r   r$   r   r   9   s    r   c                   @     e Zd ZdZdZdS )MultipleObjectsReturnedz
    The MultipleObjectsReturned exception is raised when doing a ``.get()`` operation,
    and more than one object is returned.
    z8Multiple objects returned for "{}", expected exactly oneNr	   r
   r   r   r'   r   r   r   r   r-   J   s    r-   c                   @  s$   e Zd ZdZdd
dZdddZdS )ObjectDoesNotExistErrorzf
    The DoesNotExist exception is raised when an item with the passed primary key does not exist
    r   type[Model]pk_namer   pk_valr   r   r   c                 C  s   || _ || _|| _d S r   )r   r1   r2   )r"   r   r1   r2   r   r   r   r!   X   s   
z ObjectDoesNotExistError.__init__c                 C  s   | j j d| j d| j S )Nz has no object with =)r   r	   r1   r2   r)   r   r   r   r&   ]   s   zObjectDoesNotExistError.__str__N)r   r0   r1   r   r2   r   r   r   r*   )r	   r
   r   r   r!   r&   r   r   r   r   r/   S   s    
r/   c                   @  r,   )DoesNotExistzc
    The DoesNotExist exception is raised when expecting data, such as a ``.get()`` operation.
    zObject "{}" does not existNr.   r   r   r   r   r4   a   s    r4   c                   @  r   )IncompleteInstanceErrorzl
    The IncompleteInstanceError exception is raised when a partial model is attempted to be persisted.
    Nr   r   r   r   r   r5   i   r   r5   c                   @  r   )DBConnectionErrorzT
    The DBConnectionError is raised when problems with connecting to db occurs
    Nr   r   r   r   r   r6   o   r   r6   c                   @  r   )ValidationErrorzQ
    The ValidationError is raised when validators of field validate failed.
    Nr   r   r   r   r   r7   u   r   r7   c                   @  r   )UnSupportedErrorzI
    The UnSupportedError is raised when operation is not supported.
    Nr   r   r   r   r   r8   {   r   r8   N)
__future__r   typingr   r   tortoiser   	Exceptionr   r   r   r   r   r   r   r   r   r-   KeyErrorr/   r4   r5   ConnectionErrorr6   r7   r8   r   r   r   r   <module>   s(    	