pyramid_debugtoolbar
pyramid_debugtoolbar copied to clipboard
proprosal: safe panel invocations
Under the current toolbar design, if an error occurs in a debug panel or panel rendering, a generic wsgi error is generated.
I propose wrapping the invocations of various panel API methods in a try/except block. If an error is raised it is either tracked on the toolbar or the panel via a new attribute .is_panel_error
or similar. it is logged at an log.ERROR level too. the html for broken panels is replaced with a 'error in the panel' message.
thoughts? this would require adding a new panel attribute or some code to track broken panels, so I wanted to discuss before trying a PR.
I would not extend the panel itself to track this... it's like asking something to track its own failure... then why didn't it just do the right thing in the first place if it thought it was going to fail? The toolbar could be updated to track broken panels. If it's done cleanly I'm not against merging some support for it.