o
    :F¶d€  ã                   @   st   d dl Z d dlZd dlZddl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dS )é    Né   )Úcli_constants)Ú__version__c                   @   ó   e Zd ZdZdS )Ú)RequiredValueNotInDefaultOrUserInputErrorzcA required value was not in the specified defaults file, nor was it provided as part of user input.N©Ú__name__Ú
__module__Ú__qualname__Ú__doc__© r   r   ú:usr/lib/python3.10/site-packages/oci_cli/cli_exceptions.pyr      ó    r   c                   @   r   )Ú3RequiredValueNotAvailableInternallyOrUserInputErrorzkA required value was not available internally (via SDK API call) nor was it provided as part of user input.Nr   r   r   r   r   r      r   r   c                   @   ó    e Zd ZdZdd„ Zdd„ ZdS )ÚClientExceptionzUCustom Client Exception class that accepts kwargs as input and returns formatted JSONc                 O   sx   |}d|d< dt j› d}d|v r|d  d| 7  < n||d< dt› |d< d	|d
< tj ¡  ¡ |d< || _|| _d S )NúQPlease run the OCI CLI command using --debug flag to find more debug information.Úlogging_tipsúSee [úÈ] for more information about resolving this error. If you are unable to resolve this issue, run this CLI command with --debug option and contact Oracle support and provide them the full error message.Útroubleshooting_tipsú zOracle-PythonCLI/Úclient_versionZCLIZtarget_serviceÚ	timestamp)r   ZTROUBLESHOOTING_DOCUMENTATIONr   ÚdatetimeÚutcnowÚ	isoformatÚexception_dictÚexception_class)Úselfr   ÚargsÚkwargsr   r   r   r   r   Ú__init__   s   
zClientException.__init__c                 C   ó4   | j }tj|ddd}d}t |j| j|d¡ d S ©Né   T)ÚindentÚ	sort_keysz{exc}:
{details})ÚexcÚdetails©r   ÚjsonÚdumpsÚsysÚexitÚformatr   ©r   Zexception_respr)   Ztplr   r   r   Ú__str__'   ó   zClientException.__str__N©r   r	   r
   r   r"   r1   r   r   r   r   r      s    r   c                   @   r   )ÚServiceExceptionzVCustom Service Exception class that accepts kwargs as input and returns formatted JSONc                 O   sd   |  |¡ || _|| _d|d< dtj› d|d< d|v r)|d  d t¡7  < d S d t¡|d< d S )	Nr   r   r   r   r   r   z, Oracle-PythonCLI/{}zOracle-PythonCLI/{})Úupdater   r   r   ZSERVICE_ERROR_DOCUMENTATIONr/   r   )r   r   r   r    r!   r   r   r   r"   1   s   
zServiceException.__init__c                 C   r#   r$   r*   r0   r   r   r   r1   <   r2   zServiceException.__str__Nr3   r   r   r   r   r4   .   s    r4   )r-   r+   r   Ú r   Úversionr   Ú	Exceptionr   r   r   r4   r   r   r   r   Ú<module>   s   