extract render detailed exception in own method #14225

Closed
wants to merge 4 commits into
from

Projects

None yet

4 participants

@ecoologic
Contributor

Refactor: Improves readability and modularity.

We're using Frisby.js. In our own project we monkey patched DebugExceptions#render_exception to return a JSON response which includes the stacktrace, it makes debug easier.

With this extraction you'll only have to override the logic that actually renders the HTML.

@dmathieu
Contributor

I like that idea. 👍
I'd push it a bit further though, as right now we'd need to rewrite the entire method.
How about having other methods for retrieving the template, and rendering in html and json?

A bit like what we already do with responders in to_html and to_format.

Also, as this would become public API, it will need a changelog entry and to be documented.

@ecoologic
Contributor

@dmathieu thanks and sorry I didn't follow up, I'll keep an eye one this from now on.

I implemented a solution that handles the exception in a throw away class
https://github.com/net-engine/rails/compare/exception_handler?expand=1

There's currently 1 failing test, if you think there's any value in that branch I'll fix it, if not, please let me know how it's different from what you had in mind and I'll amend accordingly.

Thanks

@robin850 robin850 added the actionpack label Mar 23, 2014
@robin850 robin850 added this to the 4.2.0 milestone Mar 23, 2014
@rafaelfranca rafaelfranca modified the milestone: 4.2.0, 5.0.0 Aug 18, 2014
@ecoologic ecoologic closed this Aug 29, 2014
@ecoologic ecoologic deleted the net-engine:patchable_exceptions branch Aug 29, 2014
@rafaelfranca rafaelfranca modified the milestone: 5.0.0 [temp], 5.0.0 Dec 30, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment