forked from orbit-oss/flask
Merge pull request #830 from hntw/patch-1
Update blueprints.rst - Add Error Handlers
This commit is contained in:
commit
21f3ad2671
1 changed files with 15 additions and 0 deletions
|
|
@ -202,3 +202,18 @@ you can use relative redirects by prefixing the endpoint with a dot only::
|
|||
|
||||
This will link to ``admin.index`` for instance in case the current request
|
||||
was dispatched to any other admin blueprint endpoint.
|
||||
|
||||
Error Handlers
|
||||
--------------
|
||||
|
||||
Blueprints support the errorhandler decorator just like the :class:`Flask`
|
||||
application object, so it is easy to make Blueprint-specific custom error
|
||||
pages.
|
||||
|
||||
Here is an example for a "404 Page Not Found" exception::
|
||||
|
||||
@simple_page.errorhandler(404)
|
||||
def page_not_found(e):
|
||||
return render_template('pages/404.html')
|
||||
|
||||
More information on error handling see :ref:`errorpages`.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue