docusign_esign.client.api_exception

DocuSign REST API

The DocuSign REST API provides you with a powerful, convenient, and simple Web services API for interacting with DocuSign.

OpenAPI spec version: v2 Contact: devcenter@docusign.com Generated by: https://github.com/swagger-api/swagger-codegen.git

 1# coding: utf-8
 2
 3"""
 4    DocuSign REST API
 5
 6    The DocuSign REST API provides you with a powerful, convenient, and simple Web services API for interacting with DocuSign.
 7
 8    OpenAPI spec version: v2
 9    Contact: devcenter@docusign.com
10    Generated by: https://github.com/swagger-api/swagger-codegen.git
11"""
12
13from __future__ import absolute_import
14
15
16class ApiException(Exception):
17
18    def __init__(self, status=None, reason=None, http_resp=None):
19        if http_resp:
20            self.status = http_resp.status
21            self.reason = http_resp.reason
22            self.body = http_resp.data
23            self.headers = http_resp.getheaders()
24            self.trace_token = http_resp.getheader('X-DocuSign-TraceToken')
25            self.timestamp = http_resp.getheader('date')
26            self.response = http_resp
27        else:
28            self.status = status
29            self.reason = reason
30            self.body = None
31            self.headers = None
32
33    def __str__(self):
34        """
35        Custom error messages for exception
36        """
37        error_message = "({0})\n" \
38                        "Reason: {1}\n" \
39                        "Trace-Token: {2}\n" \
40                        "Timestamp: {3}\n".format(self.status, self.reason, self.trace_token, self.timestamp)
41        if self.headers:
42            error_message += "HTTP response headers: {0}\n".format(self.headers)
43
44        if self.body:
45            error_message += "HTTP response body: {0}\n".format(self.body)
46
47        return error_message
48
49
50class ArgumentException(Exception):
51
52    def __init__(self, *args, **kwargs):
53        if not args:
54            super(Exception).__init__("argument cannot be empty")
55        else:
56            super(Exception).__init__(*args, **kwargs)
57
58
59class InvalidBasePath(Exception):
60    pass
class ApiException(builtins.Exception):
17class ApiException(Exception):
18
19    def __init__(self, status=None, reason=None, http_resp=None):
20        if http_resp:
21            self.status = http_resp.status
22            self.reason = http_resp.reason
23            self.body = http_resp.data
24            self.headers = http_resp.getheaders()
25            self.trace_token = http_resp.getheader('X-DocuSign-TraceToken')
26            self.timestamp = http_resp.getheader('date')
27            self.response = http_resp
28        else:
29            self.status = status
30            self.reason = reason
31            self.body = None
32            self.headers = None
33
34    def __str__(self):
35        """
36        Custom error messages for exception
37        """
38        error_message = "({0})\n" \
39                        "Reason: {1}\n" \
40                        "Trace-Token: {2}\n" \
41                        "Timestamp: {3}\n".format(self.status, self.reason, self.trace_token, self.timestamp)
42        if self.headers:
43            error_message += "HTTP response headers: {0}\n".format(self.headers)
44
45        if self.body:
46            error_message += "HTTP response body: {0}\n".format(self.body)
47
48        return error_message

Common base class for all non-exit exceptions.

ApiException(status=None, reason=None, http_resp=None)
19    def __init__(self, status=None, reason=None, http_resp=None):
20        if http_resp:
21            self.status = http_resp.status
22            self.reason = http_resp.reason
23            self.body = http_resp.data
24            self.headers = http_resp.getheaders()
25            self.trace_token = http_resp.getheader('X-DocuSign-TraceToken')
26            self.timestamp = http_resp.getheader('date')
27            self.response = http_resp
28        else:
29            self.status = status
30            self.reason = reason
31            self.body = None
32            self.headers = None
Inherited Members
builtins.BaseException
with_traceback
args
class ArgumentException(builtins.Exception):
51class ArgumentException(Exception):
52
53    def __init__(self, *args, **kwargs):
54        if not args:
55            super(Exception).__init__("argument cannot be empty")
56        else:
57            super(Exception).__init__(*args, **kwargs)

Common base class for all non-exit exceptions.

ArgumentException(*args, **kwargs)
53    def __init__(self, *args, **kwargs):
54        if not args:
55            super(Exception).__init__("argument cannot be empty")
56        else:
57            super(Exception).__init__(*args, **kwargs)
Inherited Members
builtins.BaseException
with_traceback
args
class InvalidBasePath(builtins.Exception):
60class InvalidBasePath(Exception):
61    pass

Common base class for all non-exit exceptions.

Inherited Members
builtins.Exception
Exception
builtins.BaseException
with_traceback
args