Skip to content

catching errors in finished_callbacks ? #331

@jvanasco

Description

@jvanasco

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions