From 5dd9335aac116a3d597f1342d7dba62b823a285b Mon Sep 17 00:00:00 2001 From: Torstein Krause Johansen Date: Tue, 31 Mar 2015 17:35:29 +0200 Subject: [PATCH 1/2] Added note that @errorhandler(500) isn't triggered in debug mode --- docs/patterns/errorpages.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/patterns/errorpages.rst b/docs/patterns/errorpages.rst index 4532e120..2729cdcf 100644 --- a/docs/patterns/errorpages.rst +++ b/docs/patterns/errorpages.rst @@ -77,3 +77,6 @@ An example template might be this:

What you were looking for is just not there.

go somewhere nice {% endblock %} + +Please note that if you add an error handler for "500 Internal Server +Error", Flask will not trigger it if it's running in Debug mode. From 557a053e3b2b43ec2a54298c952ce67fd0d27936 Mon Sep 17 00:00:00 2001 From: Torstein Krause Johansen Date: Tue, 31 Mar 2015 19:16:33 +0200 Subject: [PATCH 2/2] Moved noted about HTTP 500 before the code examples - as suggested by @keyan --- docs/patterns/errorpages.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/patterns/errorpages.rst b/docs/patterns/errorpages.rst index 2729cdcf..fccd4a6f 100644 --- a/docs/patterns/errorpages.rst +++ b/docs/patterns/errorpages.rst @@ -58,6 +58,9 @@ decorator and the error code of the exception. Keep in mind that Flask will *not* set the error code for you, so make sure to also provide the HTTP status code when returning a response. +Please note that if you add an error handler for "500 Internal Server +Error", Flask will not trigger it if it's running in Debug mode. + Here an example implementation for a "404 Page Not Found" exception:: from flask import render_template @@ -78,5 +81,3 @@ An example template might be this:

go somewhere nice {% endblock %} -Please note that if you add an error handler for "500 Internal Server -Error", Flask will not trigger it if it's running in Debug mode.