{"action":"created","issue":{"url":"https://api.github.com/repos/pecan/pecan/issues/6","labels_url":"https://api.github.com/repos/pecan/pecan/issues/6/labels{/name}","comments_url":"https://api.github.com/repos/pecan/pecan/issues/6/comments","events_url":"https://api.github.com/repos/pecan/pecan/issues/6/events","html_url":"https://github.com/pecan/pecan/issues/6","id":97771401,"number":6,"title":"pecan.abort exception changes on each run","user":{"login":"ryanpetrello","id":214912,"avatar_url":"https://avatars.githubusercontent.com/u/214912?v=3","gravatar_id":"","url":"https://api.github.com/users/ryanpetrello","html_url":"https://github.com/ryanpetrello","followers_url":"https://api.github.com/users/ryanpetrello/followers","following_url":"https://api.github.com/users/ryanpetrello/following{/other_user}","gists_url":"https://api.github.com/users/ryanpetrello/gists{/gist_id}","starred_url":"https://api.github.com/users/ryanpetrello/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ryanpetrello/subscriptions","organizations_url":"https://api.github.com/users/ryanpetrello/orgs","repos_url":"https://api.github.com/users/ryanpetrello/repos","events_url":"https://api.github.com/users/ryanpetrello/events{/privacy}","received_events_url":"https://api.github.com/users/ryanpetrello/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-07-28T18:36:19Z","updated_at":"2015-07-31T18:15:32Z","closed_at":null,"body":"Originally reported by Stanislaw Pitucha at https://bugs.launchpad.net/pecan/+bug/1478732\r\n\r\nThere's an issue with the way Pecan chooses exception to raise on pecan.abort(). The exception is selected based only on the http status code, but that's not a 1-many mapping.\r\n\r\nWhen webob initialises the status_map, any out of 5 exceptions can end up being the last one assigned to 500 for example. With some debugging code:\r\n\r\nadded error 500 = <class 'webob.exc.HTTPInternalServerError'>\r\nadded error 500 = <class 'webob.exc.HTTPError'>\r\nadded error 500 = <class 'webob.exc.HTTPServerError'>\r\nadded error 500 = <class 'webob.exc.WSGIHTTPException'>\r\nadded error 500 = <class 'webob.exc.HTTPRedirection'>\r\n\r\nThis wouldn't be that bad if they were all  HTTPServerError-s for example. But here WSGIHTTPException comes from a different hierarhy and it's not a child of HTTPServerError, only of HTTPError.\r\n\r\nWhile this doesn't make much difference at runtime and the final response for the user, it affects functional testing of pecan apps. Anchor ran into this issue when testing for failures produced by pecan.abort(500, \"...\"). On half of the test runs the expected HTTPServerError was caught, on the other half WSGIHTTPException broke the testing.\r\n\r\nI think pecan should keep its own status map keeping the most specific errors only (like the table in the comment at https://github.com/Pylons/webob/blob/master/webob/exc.py#L20). But I'm sure there are other possible solutions. The most important thing is that pecan should return the same error on every run, not a random one."},"comment":{"url":"https://api.github.com/repos/pecan/pecan/issues/comments/126774810","html_url":"https://github.com/pecan/pecan/issues/6#issuecomment-126774810","issue_url":"https://api.github.com/repos/pecan/pecan/issues/6","id":126774810,"user":{"login":"ryanpetrello","id":214912,"avatar_url":"https://avatars.githubusercontent.com/u/214912?v=3","gravatar_id":"","url":"https://api.github.com/users/ryanpetrello","html_url":"https://github.com/ryanpetrello","followers_url":"https://api.github.com/users/ryanpetrello/followers","following_url":"https://api.github.com/users/ryanpetrello/following{/other_user}","gists_url":"https://api.github.com/users/ryanpetrello/gists{/gist_id}","starred_url":"https://api.github.com/users/ryanpetrello/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ryanpetrello/subscriptions","organizations_url":"https://api.github.com/users/ryanpetrello/orgs","repos_url":"https://api.github.com/users/ryanpetrello/repos","events_url":"https://api.github.com/users/ryanpetrello/events{/privacy}","received_events_url":"https://api.github.com/users/ryanpetrello/received_events","type":"User","site_admin":false},"created_at":"2015-07-31T18:15:32Z","updated_at":"2015-07-31T18:15:32Z","body":"Resolved in the next release of webob:\r\nhttps://github.com/Pylons/webob/pull/210"}}