Code Review
/
pti
/
o2.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
review
|
tree
raw
|
patch
| inline |
side by side
(from parent 1:
46d810e
)
Wrap all exception with ProblemDetail in json object
20/9820/1
author
Bin Yang
<bin.yang@windriver.com>
Wed, 23 Nov 2022 09:31:51 +0000
(17:31 +0800)
committer
Jackie Huang
<jackie.huang@windriver.com>
Fri, 25 Nov 2022 08:27:29 +0000
(16:27 +0800)
Issue-ID: INF-376
Signed-off-by: Bin Yang <bin.yang@windriver.com>
Change-Id: I3f8ed081c5896eedda311f00e5a57e7ccf461a56
o2common/views/route_exception.py
patch
|
blob
|
history
diff --git
a/o2common/views/route_exception.py
b/o2common/views/route_exception.py
index
07a60a3
..
ccb439b
100644
(file)
--- a/
o2common/views/route_exception.py
+++ b/
o2common/views/route_exception.py
@@
-85,3
+85,9
@@
def configure_exception(app):
'''Return a custom message and 500 status code'''
problem = ProblemDetails(500, "Internal Server Error")
return problem.serialize(), 500
+
+ @app.errorhandler(Exception)
+ def handle_general_exception(error):
+ '''Return a custom message and 500 status code'''
+ problem = ProblemDetails(500, "Internal Server Error")
+ return problem.serialize(), 500