Use better_errors during development?

Hi all,

I discovered “better_errors” last night. It does exactly what it’s called, making errors much more friendly for developers.

It would be fantastic to be able to use this with Middleman, as the README claims it can be used not just with Rails, but for anything Rack-based.

Has anyone gotten it to work? I’ve tried (and searched around a bit for a solution), but I’m only able to see standard errors. Perhaps I’m missing something simple.

Thanks in advance!

1 Like

What kind of errors are you looking to see?

I would love to use better_errors too. I tried to config, but no success.

I think the terminal output is enough logging. But if you do want to use better_errors, you can.

  1. Add the better_errors gem to your Gemfile
  2. Run the bundle command
  3. Edit your config.rb and add the following:
    require "better_errors"
    configure :development do
      use BetterErrors::Middleware
      BetterErrors.application_root = __dir__

And you should be good to go.

If you’re having problems, make sure you’re adding the middleman just to the development environment. And that you have ruby 2.0, so __dir__ works.

1 Like

How about gem "binding_of_caller"? I that configurable too, any one have experience with that?

For anyone who still sees the basic error page instead of the better_errors version: You have to explicitly remove the Rack::ShowExceptions middleware. This can be achieved by configuration:

set :show_exceptions, false # Disable Rack::ShowExceptions middleware

And then configuring better_errors:

require 'better_errors' # Do not forget to load the gem
configure :development do
  use BetterErrors::Middleware
  BetterErrors.application_root = __dir__

Now exceptions are handled by better_errors instead of Rack::ShowExceptions.


Has this been tested recently? It doesn’t seem to work anymore.

thanks! ok so i got better errors to show up. but now on the right of the error pannel is says

No exception information available
Middleman reloads all dependencies for each request, which breaks Better Errors.
More about Better Errors
Screenshot from 2017-10-13 14-59-05

Got the same issue. Anyone knows how to make it working?