[TIP] better_errors gem

Matt Wagner matt.wagner at redhat.com
Tue Dec 11 21:55:10 UTC 2012


On Tue, Dec 11, 2012 at 01:59:56PM +0100, Tomas Sedovic wrote:
> On 12/10/2012 09:51 AM, Petr Blaho wrote:
> > Hi,
> > 
> > in my feedreader I found a link to interesting gem -
> > better_errors (https://github.com/charliesome/better_errors).
> > 
> > It makes rails (and not only rails) error page in development env more
> > usable than before. It makes stacktrace clickable and for each line in
> > stacktrace it displays source code around that line, list of local and
> > instance variables with values and interactive REPL inside that error
> > page.
> > 
> > Hope it will make development of ruby/rails apps easier.
> 
> Yeah I looked at that as well and I'm definitely in favour of giving
> this a try.
> 
> What Sayeth The Community?

It's really slick, and definitely _much_ better than what's included by
default.

It seems to be of limited use in Conductor, though, because we rescue
nearly all exceptions in ApplicationController and display a flash
message, so errors never bubble up high enough for better_errors to
handle them.

I did comment them out in application_controller.rb to play around,
though, and I'm really liking it. I briefly thought that we could try to
conditionalize these based on environment, but I think that's a bad
idea. (It seems that "only in development" or "only in production"
patches have _always_ blown up in my face.)

I suppose that when debugging unexpected errors, it wouldn't be a bad
idea to comment the rescue lines out, and then drop 'better_errors' and
'binding_of_caller' (for the interactive REPL) in your Gemfile? :-\

-- Matt


More information about the aeolus-devel mailing list