{"action":"created","comment":{"url":"https://api.github.com/repos/mitsuhiko/flask/pulls/comments/28197044","id":28197044,"diff_hunk":"@@ -1370,6 +1390,33 @@ def url_defaults(self, f):\n         self.url_default_functions.setdefault(None, []).append(f)\n         return f\n \n+    def _find_error_handler(self, e):\n+        \"\"\"Finds a registered error handler for the request’s blueprint.\n+        If neither blueprint nor App has a suitable handler registered, returns None\n+        \"\"\"\n+        exc_class, code = self._get_exc_class_and_code(type(e))\n+        \n+        def find_superclass(d):\n+            if not d:\n+                return None\n+            for superclass in exc_class.mro():\n+                if superclass is BaseException:\n+                    return None\n+                handler = d.get(superclass)\n+                if handler is not None:\n+                    d[exc_class] = handler  # cache for next time exc_class is raised","path":"flask/app.py","position":null,"original_position":102,"commit_id":"b31252db55cfac4605ad917d34eaa55fff248a38","original_commit_id":"a174d23cc6c36ee683bb1c9565909183b0701ce6","user":{"login":"flying-sheep","id":291575,"avatar_url":"https://avatars.githubusercontent.com/u/291575?v=3","gravatar_id":"","url":"https://api.github.com/users/flying-sheep","html_url":"https://github.com/flying-sheep","followers_url":"https://api.github.com/users/flying-sheep/followers","following_url":"https://api.github.com/users/flying-sheep/following{/other_user}","gists_url":"https://api.github.com/users/flying-sheep/gists{/gist_id}","starred_url":"https://api.github.com/users/flying-sheep/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flying-sheep/subscriptions","organizations_url":"https://api.github.com/users/flying-sheep/orgs","repos_url":"https://api.github.com/users/flying-sheep/repos","events_url":"https://api.github.com/users/flying-sheep/events{/privacy}","received_events_url":"https://api.github.com/users/flying-sheep/received_events","type":"User","site_admin":false},"body":"hmm, as i said: it’s forbidden to register new routes after app start, so the cache will never be invalidated.\r\n\r\nthat’s the main reason i implemented it: very simple and no potential for failure","created_at":"2015-04-11T18:00:31Z","updated_at":"2015-04-11T18:00:31Z","html_url":"https://github.com/mitsuhiko/flask/pull/1291#discussion_r28197044","pull_request_url":"https://api.github.com/repos/mitsuhiko/flask/pulls/1291","_links":{"self":{"href":"https://api.github.com/repos/mitsuhiko/flask/pulls/comments/28197044"},"html":{"href":"https://github.com/mitsuhiko/flask/pull/1291#discussion_r28197044"},"pull_request":{"href":"https://api.github.com/repos/mitsuhiko/flask/pulls/1291"}}},"pull_request":{"url":"https://api.github.com/repos/mitsuhiko/flask/pulls/1291","id":26524434,"html_url":"https://github.com/mitsuhiko/flask/pull/1291","diff_url":"https://github.com/mitsuhiko/flask/pull/1291.diff","patch_url":"https://github.com/mitsuhiko/flask/pull/1291.patch","issue_url":"https://api.github.com/repos/mitsuhiko/flask/issues/1291","number":1291,"state":"closed","locked":false,"title":"Fixed and intuitivized exception handling","user":{"login":"flying-sheep","id":291575,"avatar_url":"https://avatars.githubusercontent.com/u/291575?v=3","gravatar_id":"","url":"https://api.github.com/users/flying-sheep","html_url":"https://github.com/flying-sheep","followers_url":"https://api.github.com/users/flying-sheep/followers","following_url":"https://api.github.com/users/flying-sheep/following{/other_user}","gists_url":"https://api.github.com/users/flying-sheep/gists{/gist_id}","starred_url":"https://api.github.com/users/flying-sheep/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flying-sheep/subscriptions","organizations_url":"https://api.github.com/users/flying-sheep/orgs","repos_url":"https://api.github.com/users/flying-sheep/repos","events_url":"https://api.github.com/users/flying-sheep/events{/privacy}","received_events_url":"https://api.github.com/users/flying-sheep/received_events","type":"User","site_admin":false},"body":"abandoning pull request #1281 for this.\r\n\r\nthe rationale for this is to\r\n\r\n1. fix some logic flaws\r\n2. make errorhandlers more intuitive by making them rely on exception hierarchy instead of registration order\r\n3. Enable 500 handlers on blueprint level\r\n\r\nand all this while without breaking compatibility in not-already-broken usecases (which rely on the logic flaws i fixed)\r\n\r\nTODO:\r\n\r\n1. bake this into some tests as well\r\n2. one error says\r\n\r\n    > It is currently not possible to register a 500 internal server error on a per-blueprint level.\r\n\r\n    why is this?","created_at":"2014-12-23T18:18:53Z","updated_at":"2015-04-11T18:00:31Z","closed_at":"2015-04-11T16:13:22Z","merged_at":"2015-04-11T16:13:22Z","merge_commit_sha":"558f56dd62e3731f2d54b732565474c54a3c28bf","assignee":null,"milestone":{"url":"https://api.github.com/repos/mitsuhiko/flask/milestones/2","html_url":"https://github.com/mitsuhiko/flask/milestones/1.0","labels_url":"https://api.github.com/repos/mitsuhiko/flask/milestones/2/labels","id":795954,"number":2,"title":"1.0","description":"","creator":{"login":"untitaker","id":837573,"avatar_url":"https://avatars.githubusercontent.com/u/837573?v=3","gravatar_id":"","url":"https://api.github.com/users/untitaker","html_url":"https://github.com/untitaker","followers_url":"https://api.github.com/users/untitaker/followers","following_url":"https://api.github.com/users/untitaker/following{/other_user}","gists_url":"https://api.github.com/users/untitaker/gists{/gist_id}","starred_url":"https://api.github.com/users/untitaker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/untitaker/subscriptions","organizations_url":"https://api.github.com/users/untitaker/orgs","repos_url":"https://api.github.com/users/untitaker/repos","events_url":"https://api.github.com/users/untitaker/events{/privacy}","received_events_url":"https://api.github.com/users/untitaker/received_events","type":"User","site_admin":false},"open_issues":10,"closed_issues":8,"state":"open","created_at":"2014-09-19T15:47:20Z","updated_at":"2015-04-11T16:22:32Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/mitsuhiko/flask/pulls/1291/commits","review_comments_url":"https://api.github.com/repos/mitsuhiko/flask/pulls/1291/comments","review_comment_url":"https://api.github.com/repos/mitsuhiko/flask/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mitsuhiko/flask/issues/1291/comments","statuses_url":"https://api.github.com/repos/mitsuhiko/flask/statuses/b31252db55cfac4605ad917d34eaa55fff248a38","head":{"label":"flying-sheep:errorhandler-rework","ref":"errorhandler-rework","sha":"b31252db55cfac4605ad917d34eaa55fff248a38","user":{"login":"flying-sheep","id":291575,"avatar_url":"https://avatars.githubusercontent.com/u/291575?v=3","gravatar_id":"","url":"https://api.github.com/users/flying-sheep","html_url":"https://github.com/flying-sheep","followers_url":"https://api.github.com/users/flying-sheep/followers","following_url":"https://api.github.com/users/flying-sheep/following{/other_user}","gists_url":"https://api.github.com/users/flying-sheep/gists{/gist_id}","starred_url":"https://api.github.com/users/flying-sheep/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flying-sheep/subscriptions","organizations_url":"https://api.github.com/users/flying-sheep/orgs","repos_url":"https://api.github.com/users/flying-sheep/repos","events_url":"https://api.github.com/users/flying-sheep/events{/privacy}","received_events_url":"https://api.github.com/users/flying-sheep/received_events","type":"User","site_admin":false},"repo":{"id":28057074,"name":"flask","full_name":"flying-sheep/flask","owner":{"login":"flying-sheep","id":291575,"avatar_url":"https://avatars.githubusercontent.com/u/291575?v=3","gravatar_id":"","url":"https://api.github.com/users/flying-sheep","html_url":"https://github.com/flying-sheep","followers_url":"https://api.github.com/users/flying-sheep/followers","following_url":"https://api.github.com/users/flying-sheep/following{/other_user}","gists_url":"https://api.github.com/users/flying-sheep/gists{/gist_id}","starred_url":"https://api.github.com/users/flying-sheep/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flying-sheep/subscriptions","organizations_url":"https://api.github.com/users/flying-sheep/orgs","repos_url":"https://api.github.com/users/flying-sheep/repos","events_url":"https://api.github.com/users/flying-sheep/events{/privacy}","received_events_url":"https://api.github.com/users/flying-sheep/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/flying-sheep/flask","description":"A microframework based on Werkzeug, Jinja2 and good intentions","fork":true,"url":"https://api.github.com/repos/flying-sheep/flask","forks_url":"https://api.github.com/repos/flying-sheep/flask/forks","keys_url":"https://api.github.com/repos/flying-sheep/flask/keys{/key_id}","collaborators_url":"https://api.github.com/repos/flying-sheep/flask/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/flying-sheep/flask/teams","hooks_url":"https://api.github.com/repos/flying-sheep/flask/hooks","issue_events_url":"https://api.github.com/repos/flying-sheep/flask/issues/events{/number}","events_url":"https://api.github.com/repos/flying-sheep/flask/events","assignees_url":"https://api.github.com/repos/flying-sheep/flask/assignees{/user}","branches_url":"https://api.github.com/repos/flying-sheep/flask/branches{/branch}","tags_url":"https://api.github.com/repos/flying-sheep/flask/tags","blobs_url":"https://api.github.com/repos/flying-sheep/flask/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/flying-sheep/flask/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/flying-sheep/flask/git/refs{/sha}","trees_url":"https://api.github.com/repos/flying-sheep/flask/git/trees{/sha}","statuses_url":"https://api.github.com/repos/flying-sheep/flask/statuses/{sha}","languages_url":"https://api.github.com/repos/flying-sheep/flask/languages","stargazers_url":"https://api.github.com/repos/flying-sheep/flask/stargazers","contributors_url":"https://api.github.com/repos/flying-sheep/flask/contributors","subscribers_url":"https://api.github.com/repos/flying-sheep/flask/subscribers","subscription_url":"https://api.github.com/repos/flying-sheep/flask/subscription","commits_url":"https://api.github.com/repos/flying-sheep/flask/commits{/sha}","git_commits_url":"https://api.github.com/repos/flying-sheep/flask/git/commits{/sha}","comments_url":"https://api.github.com/repos/flying-sheep/flask/comments{/number}","issue_comment_url":"https://api.github.com/repos/flying-sheep/flask/issues/comments{/number}","contents_url":"https://api.github.com/repos/flying-sheep/flask/contents/{+path}","compare_url":"https://api.github.com/repos/flying-sheep/flask/compare/{base}...{head}","merges_url":"https://api.github.com/repos/flying-sheep/flask/merges","archive_url":"https://api.github.com/repos/flying-sheep/flask/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/flying-sheep/flask/downloads","issues_url":"https://api.github.com/repos/flying-sheep/flask/issues{/number}","pulls_url":"https://api.github.com/repos/flying-sheep/flask/pulls{/number}","milestones_url":"https://api.github.com/repos/flying-sheep/flask/milestones{/number}","notifications_url":"https://api.github.com/repos/flying-sheep/flask/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/flying-sheep/flask/labels{/name}","releases_url":"https://api.github.com/repos/flying-sheep/flask/releases{/id}","created_at":"2014-12-15T21:28:01Z","updated_at":"2015-04-11T16:17:43Z","pushed_at":"2015-04-11T16:17:43Z","git_url":"git://github.com/flying-sheep/flask.git","ssh_url":"git@github.com:flying-sheep/flask.git","clone_url":"https://github.com/flying-sheep/flask.git","svn_url":"https://github.com/flying-sheep/flask","homepage":"http://flask.pocoo.org/","size":5096,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mitsuhiko:master","ref":"master","sha":"dac45f6c5d2dc69a59561dc70579cc16a980bd21","user":{"login":"mitsuhiko","id":7396,"avatar_url":"https://avatars.githubusercontent.com/u/7396?v=3","gravatar_id":"","url":"https://api.github.com/users/mitsuhiko","html_url":"https://github.com/mitsuhiko","followers_url":"https://api.github.com/users/mitsuhiko/followers","following_url":"https://api.github.com/users/mitsuhiko/following{/other_user}","gists_url":"https://api.github.com/users/mitsuhiko/gists{/gist_id}","starred_url":"https://api.github.com/users/mitsuhiko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mitsuhiko/subscriptions","organizations_url":"https://api.github.com/users/mitsuhiko/orgs","repos_url":"https://api.github.com/users/mitsuhiko/repos","events_url":"https://api.github.com/users/mitsuhiko/events{/privacy}","received_events_url":"https://api.github.com/users/mitsuhiko/received_events","type":"User","site_admin":false},"repo":{"id":596892,"name":"flask","full_name":"mitsuhiko/flask","owner":{"login":"mitsuhiko","id":7396,"avatar_url":"https://avatars.githubusercontent.com/u/7396?v=3","gravatar_id":"","url":"https://api.github.com/users/mitsuhiko","html_url":"https://github.com/mitsuhiko","followers_url":"https://api.github.com/users/mitsuhiko/followers","following_url":"https://api.github.com/users/mitsuhiko/following{/other_user}","gists_url":"https://api.github.com/users/mitsuhiko/gists{/gist_id}","starred_url":"https://api.github.com/users/mitsuhiko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mitsuhiko/subscriptions","organizations_url":"https://api.github.com/users/mitsuhiko/orgs","repos_url":"https://api.github.com/users/mitsuhiko/repos","events_url":"https://api.github.com/users/mitsuhiko/events{/privacy}","received_events_url":"https://api.github.com/users/mitsuhiko/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mitsuhiko/flask","description":"A microframework based on Werkzeug, Jinja2 and good intentions","fork":false,"url":"https://api.github.com/repos/mitsuhiko/flask","forks_url":"https://api.github.com/repos/mitsuhiko/flask/forks","keys_url":"https://api.github.com/repos/mitsuhiko/flask/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mitsuhiko/flask/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mitsuhiko/flask/teams","hooks_url":"https://api.github.com/repos/mitsuhiko/flask/hooks","issue_events_url":"https://api.github.com/repos/mitsuhiko/flask/issues/events{/number}","events_url":"https://api.github.com/repos/mitsuhiko/flask/events","assignees_url":"https://api.github.com/repos/mitsuhiko/flask/assignees{/user}","branches_url":"https://api.github.com/repos/mitsuhiko/flask/branches{/branch}","tags_url":"https://api.github.com/repos/mitsuhiko/flask/tags","blobs_url":"https://api.github.com/repos/mitsuhiko/flask/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mitsuhiko/flask/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mitsuhiko/flask/git/refs{/sha}","trees_url":"https://api.github.com/repos/mitsuhiko/flask/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mitsuhiko/flask/statuses/{sha}","languages_url":"https://api.github.com/repos/mitsuhiko/flask/languages","stargazers_url":"https://api.github.com/repos/mitsuhiko/flask/stargazers","contributors_url":"https://api.github.com/repos/mitsuhiko/flask/contributors","subscribers_url":"https://api.github.com/repos/mitsuhiko/flask/subscribers","subscription_url":"https://api.github.com/repos/mitsuhiko/flask/subscription","commits_url":"https://api.github.com/repos/mitsuhiko/flask/commits{/sha}","git_commits_url":"https://api.github.com/repos/mitsuhiko/flask/git/commits{/sha}","comments_url":"https://api.github.com/repos/mitsuhiko/flask/comments{/number}","issue_comment_url":"https://api.github.com/repos/mitsuhiko/flask/issues/comments{/number}","contents_url":"https://api.github.com/repos/mitsuhiko/flask/contents/{+path}","compare_url":"https://api.github.com/repos/mitsuhiko/flask/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mitsuhiko/flask/merges","archive_url":"https://api.github.com/repos/mitsuhiko/flask/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mitsuhiko/flask/downloads","issues_url":"https://api.github.com/repos/mitsuhiko/flask/issues{/number}","pulls_url":"https://api.github.com/repos/mitsuhiko/flask/pulls{/number}","milestones_url":"https://api.github.com/repos/mitsuhiko/flask/milestones{/number}","notifications_url":"https://api.github.com/repos/mitsuhiko/flask/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mitsuhiko/flask/labels{/name}","releases_url":"https://api.github.com/repos/mitsuhiko/flask/releases{/id}","created_at":"2010-04-06T11:11:59Z","updated_at":"2015-04-11T16:13:24Z","pushed_at":"2015-04-11T16:13:23Z","git_url":"git://github.com/mitsuhiko/flask.git","ssh_url":"git@github.com:mitsuhiko/flask.git","clone_url":"https://github.com/mitsuhiko/flask.git","svn_url":"https://github.com/mitsuhiko/flask","homepage":"http://flask.pocoo.org/","size":15444,"stargazers_count":13404,"watchers_count":13404,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3851,"mirror_url":null,"open_issues_count":139,"forks":3851,"open_issues":139,"watchers":13404,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mitsuhiko/flask/pulls/1291"},"html":{"href":"https://github.com/mitsuhiko/flask/pull/1291"},"issue":{"href":"https://api.github.com/repos/mitsuhiko/flask/issues/1291"},"comments":{"href":"https://api.github.com/repos/mitsuhiko/flask/issues/1291/comments"},"review_comments":{"href":"https://api.github.com/repos/mitsuhiko/flask/pulls/1291/comments"},"review_comment":{"href":"https://api.github.com/repos/mitsuhiko/flask/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mitsuhiko/flask/pulls/1291/commits"},"statuses":{"href":"https://api.github.com/repos/mitsuhiko/flask/statuses/b31252db55cfac4605ad917d34eaa55fff248a38"}}}}