Make registering error handlers compliant with Flask 0.11

With Flask 0.11 setting error handlers by directly modifying
app.error_handler_spec dictionary leads to AttributeErrors.
It should be done by using register_error_handler method or
errorhandler decorator.

Change-Id: I4c6cb80a6311c081a30130ba51b8e5d7a88331b2
Closes-Bug: #1587849
This commit is contained in:
Elena Ezhova
2016-06-01 16:51:03 +03:00
parent d496d3706e
commit 6df18b545f

View File

@@ -100,7 +100,7 @@ def factory(global_config, **local_conf):
return response
for code in six.iterkeys(wexceptions.default_exceptions):
app.error_handler_spec[None][code] = _json_error
app.register_error_handler(code, _json_error)
# TODO(kiall): Ideally, we want to make use of the Plugin class here.
# This works for the moment though.