-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix for issue #209: stop logging tracebacks for raised Responses. #217
Conversation
Oops, I spoke too soon, this broke one of the tests. Working on it... |
… same way that Response(2xx)s do.
Huh, the test that is failing (redirects don't add any headers, a197211) was added after the fix that removed the call to handle_error. My fix makes it so raised 3xx responses skip the resource getting step the same way as 2xx responses do. Tell me if you can think of any problems this would cause. |
Hmm. I'm suspecting we need tests for this. Maybe a test that sets up a custom response and makes sure it gets used? Don't we have one of those already? |
Tests are probably a good idea, but to make sure it gets used in what way? I essentially made three changes:
|
Also, as far as logging tracebacks go for #209, do you think it'd be better to still log the tracebacks for some status codes, such as 5xx errors for debugging, rather than getting rid of them completely? |
That additiional 'except Response' was my attempt to not log tracebacks for 2xx and 3xx that happened to be raised - they're a kind of exceptional non-Exception. We should ideally log 5xx and maybe 4xx for debugging.. hrm, maybe just always log everything, with descending priorities: 5xx ERROR, 4xx WARNING, 3xx INFO, 2xx DEBUG ?
304 does seem to be the singular exception that MUST NOT require a message body, so the code will have to reflect it one way or the other. So it should read:
Sound reasonable? |
That sounds good, except right now aspen is using its own logging system which isn't fine-tuned enough to split up the logging like that. Perhaps a job for #157? The second part sounds perfect. This commit logs only the 5xx tracebacks (with a TODO comment about switching to the logging module) and does the part with the 304 codes. |
Fix for issue #209: stop logging tracebacks for raised Responses.
Fix for issue #209: stop logging tracebacks for raised Responses.
As I commented in #209, the previous fix prevented
handle_error
from being called at all for Response exceptions. My fix instead removeslog_error
fromhandle_error
so that errors are still handled appropriately, just without the tracebacks.