o
    i                     @   s   d dl mZm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dS )    )OptionalUnion)PIPECAT_CLI_NAMEc                   @      e Zd ZdZdS )Errorz)Base class for exceptions in this module.N__name__
__module____qualname____doc__ r   r   J/home/ubuntu/.local/lib/python3.10/site-packages/pipecatcloud/exception.pyr          r   c                   @   r   )ConfigFileErrorz#Error when config file is malformedNr   r   r   r   r   r      r   r   c                       s2   e Zd ZdZde dfdef fddZ  ZS )	AuthErrorz+Exception raised for authentication errors.z*Unauthorized / token expired. Please run `z auth login` to login again.messagec                       || _ t | j  d S Nr   super__init__selfr   	__class__r   r   r      s   zAuthError.__init__)r   r	   r
   r   r   strr   __classcell__r   r   r   r   r      s    
r   c                   @   r   )InvalidErrorz(Raised when user does something invalid.Nr   r   r   r   r   r   #   s    r   c                       s(   e Zd ZdZddef fddZ  ZS )ConfigErrorz4Raised when config is unable to be stored or updatedFailed to update configurationr   c                    r   r   r   r   r   r   r   r   *   s   zConfigError.__init__)r   )r   r	   r
   r   r   r   r   r   r   r   r   r   '   s    r   c                       s4   e Zd ZdZ		ddedee f fddZ  ZS )	AgentNotHealthyErrorz7Raised when agent is not healthy and cannot be started.?Agent deployment is not in a ready state and cannot be started.Nr   
error_codec                    s*   | d| d| _ || _t | j  d S )Nz (Error code: ))r   r"   r   r   )r   r   r"   r   r   r   r   2   s   zAgentNotHealthyError.__init__)r!   N)r   r	   r
   r   r   r   r   r   r   r   r   r   r    /   s    r    c                       s4   e Zd ZdZddeeeef  f fddZ  Z	S )AgentStartErrorz&Raised when agent start request fails.Nerrorc                    s^   t |tr|dd}|d}n
|rt|nd}d }| d| | _|| _t | j d S )Nr%   z&Unknown error. Please contact support.codez - )
isinstancedictgetr   r   r"   r   r   )r   r%   error_messager&   r   r   r   r   ?   s   
zAgentStartError.__init__r   )
r   r	   r
   r   r   r   r   r(   r   r   r   r   r   r   r$   <   s    (r$   N)typingr   r   pipecatcloud.clir   	Exceptionr   r   r   r   r   r    r$   r   r   r   r   <module>   s   