NovaBryan/EVE_Dump
Log | Files | 📦 下载最新源码 (.zip) | Refs | README

exceptions.py (1613B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\packages\datadog\api\exceptions.py
      2 
      3 
      4 class ClientError(Exception):
      5 
      6     def __init__(self, method, url, exception):
      7         message = u'Could not request {method} {url}: {exception}. Please check the network connection or try again later. If the problem persists, please contact support@datadoghq.com'.format(method=method, url=url, exception=exception)
      8         super(ClientError, self).__init__(message)
      9 
     10 
     11 class HttpTimeout(Exception):
     12 
     13     def __init__(self, method, url, timeout):
     14         message = u'{method} {url} timed out after {timeout}. Please try again later. If the problem persists, please contact support@datadoghq.com'.format(method=method, url=url, timeout=timeout)
     15         super(HttpTimeout, self).__init__(message)
     16 
     17 
     18 class HttpBackoff(Exception):
     19 
     20     def __init__(self, backoff_period):
     21         message = u"Too many timeouts. Won't try again for {backoff_period} seconds. ".format(backoff_period=backoff_period)
     22         super(HttpBackoff, self).__init__(message)
     23 
     24 
     25 class HTTPError(Exception):
     26 
     27     def __init__(self, status_code = None, reason = None):
     28         self.status_code = status_code
     29         reason = u' - {reason}'.format(reason=reason) if reason else u''
     30         message = u'Datadog returned a bad HTTP response code: {status_code}{reason}. Please try again later. If the problem persists, please contact support@datadoghq.com'.format(status_code=status_code, reason=reason)
     31         super(HTTPError, self).__init__(message)
     32 
     33 
     34 class ApiError(Exception):
     35     pass
     36 
     37 
     38 class ApiNotInitialized(Exception):
     39     pass