Skip to content
Myr

Mention register_error_handler in errorhandler doc

Before adoption: this commit came in with the history the project adopted, so no landing records it.

The documentation for @errorhandler gives "app.error_handler_spec[None][404] = page_not_found" as an example for adding an error handler without the decorator.  However, register_error_handler appears to be the correct way to do this (added 0.7), and it eliminates the problems with modifying error_handler_spec directly.

authored by Steve Leonard · committed by Steve Leonard · parent 6309987 · Browse files · 1 file+5 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+5 added−0 removed

  • other:+5 added−0 removed

1 file+5 added−0 removed

modified:flask/app.py+5 added
1064 unmodified lines
1065 The first `None` refers to the active blueprint. If the error1066 handler should be application wide `None` shall be used.10671068 .. versionadded:: 0.71069 Use :meth:`register_error_handler` instead of modifying1070 :attr:`error_handler_spec` directly, for application wide error1071 handlers.1072 1073 .. versionadded:: 0.71074 One can now additionally also register custom exception types1075 that do not necessarily have to be a subclass of the1076 :class:`~werkzeug.exceptions.HTTPException` class.1077
751 unmodified lines