[better_errors][1] is a Rack middleware that replaces the default standard rails error page with a more useful one.

The default Rails error page is also useful, but there is so much output that we don’t usually need and also there is a lot of other things we might need to see.

The features of better_errors gem are awesome:

  1. Full stack trace
  2. Source code inspection for all stack frames (with highlighting)
  3. Local and instance variable inspection
  4. Live REPL (Read-Eval-Print Loop) on every stack frame

In this local and instance variable inspection is so useful.

We can immediately see the instance variables that are set at the time of the error.


You can install it using the gem command:

gem install better\_errors


Add this lines to your Gemfile:

group :development do
  gem "better\_errors"

and then execute

bundle install

If you would like to use Better Errors' advanced features (REPL, local/instance variable inspection, pretty stack frame names), you need to add the [binding_of_caller][2] gem by @banisterfiend to your Gemfile:

gem "binding\_of\_caller"

and then bundle install

This is an optional dependency however, and Better Errors will work without it.

For more details click here [better_errors gem][3]

[binding_of_caller gem][4]

[1]: https://github.com/charliesome/better_errors
[2]: https://github.com/banister/binding_of_caller
[3]: https://github.com/charliesome/better_errors
[4]: https://github.com/banister/binding_of_caller