show nice message when registering error handler for unknown code

clean up error handler docs
closes #1837
This commit is contained in:
David Lord 2017-05-31 18:02:23 -07:00
parent 9049755e3f
commit 859d9a9d5c
No known key found for this signature in database
GPG key ID: 7A1C87E3F5BC42A8
3 changed files with 79 additions and 54 deletions

View file

@ -870,6 +870,13 @@ def test_error_handling(app, client):
assert b'forbidden' == rv.data
def test_error_handler_unknown_code(app):
with pytest.raises(KeyError) as exc_info:
app.register_error_handler(999, lambda e: ('999', 999))
assert 'Use a subclass' in exc_info.value.args[0]
def test_error_handling_processing(app, client):
app.config['LOGGER_HANDLER_POLICY'] = 'never'
app.testing = False