o
    ic                     @   s   d 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 
API & HTTP Clients exceptions.
c                   @      e Zd ZdZdS )DatadogExceptiona  
    Base class for Datadog API exceptions.  Use this for patterns like the following:

        try:
            # do something with the Datadog API
        except datadog.api.exceptions.DatadogException:
            # handle any Datadog-specific exceptions
    N__name__
__module____qualname____doc__ r   r   J/home/ubuntu/.local/lib/python3.10/site-packages/datadog/api/exceptions.pyr   	       r   c                           e Zd ZdZ fddZ  ZS )
ProxyErrorz@
    HTTP connection to the configured proxy server failed.
    c                    s"   dj ||d}tt| | d S )NzqCould not request {method} {url}: Unable to connect to proxy. Please check the proxy configuration and try again.)methodurl)formatsuperr   __init__selfr   r   	exceptionmessage	__class__r   r	   r      s
   zProxyError.__init__r   r   r   r   r   __classcell__r   r   r   r	   r          r   c                       r   )ClientErrorz>
    HTTP connection to Datadog endpoint is not possible.
    c                    $   dj |||d}tt| | d S )NzCould not request {method} {url}: {exception}. Please check the network connection or try again later. If the problem persists, please contact support@datadoghq.com)r   r   r   )r   r   r   r   r   r   r   r	   r   &      zClientError.__init__r   r   r   r   r	   r   !   r   r   c                       r   )HttpTimeoutz"
    HTTP connection timeout.
    c                    r   )Nz{method} {url} timed out after {timeout}. Please try again later. If the problem persists, please contact support@datadoghq.com)r   r   timeout)r   r   r   r   )r   r   r   r   r   r   r   r	   r   6   r   zHttpTimeout.__init__r   r   r   r   r	   r   1   r   r   c                       r   )HttpBackoffz.
    Backing off after too many timeouts.
    c                    s    dj |d}tt| | d S )NzAToo many timeouts. Won't try again for {backoff_period} seconds. )backoff_period)r   r   r    r   )r   r!   r   r   r   r	   r   F   s   zHttpBackoff.__init__r   r   r   r   r	   r    A   r   r    c                       s"   e Zd ZdZd fdd	Z  ZS )	HTTPErrorz(
    Datadog returned a HTTP error.
    Nc                    s6   |rdj |dnd}dj ||d}tt| | d S )Nz - {reason})reason zDatadog returned a bad HTTP response code: {status_code}{reason}. Please try again later. If the problem persists, please contact support@datadoghq.com)status_coder#   )r   r   r"   r   )r   r%   r#   r   r   r   r	   r   R   s   	zHTTPError.__init__)NNr   r   r   r   r	   r"   M   s    r"   c                   @   r   )ApiErrorz
    Datadog returned an API error (known HTTPError).

    Matches the following status codes: 400, 401, 403, 404, 409, 429.
    Nr   r   r   r   r	   r&   `   r
   r&   c                   @   r   )ApiNotInitializedzNo API key is setNr   r   r   r   r	   r'   h   r
   r'   N)
r   	Exceptionr   r   r   r   r    r"   r&   r'   r   r   r   r	   <module>   s   