Custom error handlers: also properly handle non-Werkzeug exceptions.
This commit is contained in:
parent
cf30bb5d62
commit
49c08cba10
@ -286,6 +286,12 @@ class PillarServer(Eve):
|
||||
|
||||
def pillar_error_handler(self, error_ob):
|
||||
|
||||
# 'error_ob' can be any exception. If it's not a Werkzeug exception,
|
||||
# handle it as a 500.
|
||||
if not hasattr(error_ob, 'code'):
|
||||
error_ob.code = 500
|
||||
error_ob.description = str(error_ob)
|
||||
|
||||
if request.full_path.startswith('/%s/' % self.config['URL_PREFIX']):
|
||||
from pillar.api.utils import jsonify
|
||||
# This is an API request, so respond in JSON.
|
||||
|
Loading…
x
Reference in New Issue
Block a user