Skip to content
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

catching errors in finished_callbacks ? #331

Open
jvanasco opened this issue May 11, 2018 · 0 comments
Open

catching errors in finished_callbacks ? #331

jvanasco opened this issue May 11, 2018 · 0 comments

Comments

@jvanasco
Copy link
Contributor

I tracked down an odd issue (which is a bit of a variant from closed #237)

this is caused by the pyramid design of finished callbacks happening after the tween egress.

If an exception is raised in a finished callback, the debugtoolbar has already considered the request to be fine -- so the client gets an error (e.g the two line waitress internal-server error) but the toolbar shows a 200.

a simple example of this is setting a value in a cookie that is too long (there is a max 4096 length due to browser header limitations)

for example, this will trigger an uncaught exception

from pyramid.session import SignedCookieSessionFactory
my_session_factory = SignedCookieSessionFactory('itsaseekreet')
config.set_session_factory(my_session_factory)
...
def a_view(request):
    request.session['a'] = "1" * 5000
    return {}

i don't think it's possible to catch these exceptions with the current design of pyramid or the toolbar, but i think it would be good to remember this type of situation as future plans are made.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant