properly implement werkzeug exceptions

parent 639de43d
Pipeline #1401 passed with stages
in 22 minutes and 58 seconds
......@@ -10,16 +10,22 @@
# Agent do not need "real" HTTP errors
try:
from werkzeug.exceptions import HTTPException
WERKZEUG = True
except ImportError:
HTTPException = Exception
WERKZEUG = False
class BUIserverException(HTTPException):
"""Raised in case of internal error."""
code = 500
def __init__(self, message):
self.description = message
def __init__(self, message="Internal Error", response=None):
if WERKZEUG:
HTTPException.__init__(self, message, response)
else:
self.description = message
self.response = response
def __str__(self):
return self.description
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment