[better_errors] 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:
- Full stack trace
- Source code inspection for all stack frames (with highlighting)
- Local and instance variable inspection
- 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" end
and then execute
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] gem by @banisterfiend to your Gemfile:
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]
Subscribe to Engineering At Kiprosh
Get the latest posts delivered right to your inbox