From aa4700c276999a002bd6ddf8c7d35993429ec2d7 Mon Sep 17 00:00:00 2001 From: Phil Schaf Date: Sun, 28 Dec 2014 16:07:56 +0100 Subject: [PATCH] More verbose message for old broken behavior --- flask/app.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/flask/app.py b/flask/app.py index 81861399..e1266d7e 100644 --- a/flask/app.py +++ b/flask/app.py @@ -1205,7 +1205,11 @@ class Flask(_PackageBoundObject): :type code_or_exception: int|T<=Exception :type f: callable """ - assert not isinstance(code_or_exception, HTTPException) # old broken behavior + if isinstance(code_or_exception, HTTPException): # old broken behavior + raise ValueError( + 'Tried to register a handler for an exception instance {0!r}. ' + 'Handlers can only be registered for exception classes or HTTP error codes.' + .format(code_or_exception)) code = code_or_exception is_code = isinstance(code_or_exception, integer_types)