FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
code-examples-python/app/error_handlers.py at master · bliotti/code-examples-python · GitHub
bliotti
/
code-examples-python
Public
forked from
docusign/code-examples-python
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
code-examples-python
/
app
/
error_handlers.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
32 lines (26 loc) · 1.12 KB
Breadcrumbs
code-examples-python
/
app
/
error_handlers.py
Copy path
File metadata and controls
32 lines (26 loc) · 1.12 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import
json
from
flask
import
render_template
from
.
api_type
import
EXAMPLES_API_TYPE
def
process_error
(
err
):
error_body_json
=
err
and
hasattr
(
err
,
"body"
)
and
err
.
body
# we can pull the DocuSign error code and message from the response body
try
:
error_body
=
json
.
loads
(
error_body_json
)
except
json
.
decoder
.
JSONDecodeError
:
error_body
=
{}
error_code
=
error_body
and
"errorCode"
in
error_body
and
error_body
[
"errorCode"
]
error_message
=
error_body
and
"message"
in
error_body
and
error_body
[
"message"
]
# Handle error specific for use conditional recipients example (eg34)
if
error_code
==
"WORKFLOW_UPDATE_RECIPIENTROUTING_NOT_ALLOWED"
:
return
render_template
(
"eSignature/error_eg34.html"
)
if
EXAMPLES_API_TYPE
[
"Monitor"
]:
if
(
"(403"
in
str
(
err
)):
return
render_template
(
"error_enable_monitor.html"
)
# In production, may want to provide customized error messages and
# remediation advice to the user.
return
render_template
(
"error.html"
,
err
=
err
,
error_code
=
error_code
,
error_message
=
error_message
)
Back
|
FazBrowse Home
|
New Git URL