BetterErrors / better_errors

Better error page for Rack apps
MIT License
6.88k stars 437 forks source link

binding_of_caller hides stack trace for ActionView::Template::Error #461

Closed JanStevens closed 4 years ago

JanStevens commented 4 years ago

The binding_of_caller gem causes the stack trace to be limited and it becomes less relevant since it just errors out on the view

Example without binding of a caller

ActionView::Template::Error - Mode 'default' is not supported for hardware type 'third_party_device':
  lib/dce/hardware.rb:200:in `validate_type_and_mode!'
  lib/dce/hardware.rb:150:in `build'
  app/models/device_config.rb:308:in `hardware_properties'
  app/models/device_config.rb:76:in `has_individual_settings?'
  app/presenters/device_config_presenter.rb:38:in `editable_individual_attributes'
  app/views/device_configs/_device_config.html.erb:32:in `block in _app_views_device_configs__device_config_html_erb__1823178735085232799_70116260432460'
  app/views/device_configs/_device_config.html.erb:1:in `_app_views_device_configs__device_config_html_erb__1823178735085232799_70116260432460'
  app/views/device_configs/index.html.erb:92:in `_app_views_device_configs_index_html_erb__1372435506255407163_70116263579040'
  app/controllers/device_configs_controller.rb:15:in `index'
  app/controllers/application_controller.rb:94:in `block in set_time_zone'
  app/controllers/application_controller.rb:92:in `set_time_zone'

With binding of a caller

ActionView::Template::Error - Mode 'default' is not supported for hardware type 'third_party_device':
  app/views/device_configs/index.html.erb:92:in `_app_views_device_configs_index_html_erb__3208808530927147380_70141257977880'
  app/controllers/device_configs_controller.rb:15:in `index'
  app/controllers/application_controller.rb:94:in `block in set_time_zone'
  app/controllers/application_controller.rb:92:in `set_time_zone'

As you can see this is a bit annoying figuring out where it went wrong. It now just shows its in the index view while I need to know the full stack trace

RobinDaugherty commented 4 years ago

I'm not sure yet exactly why binding_of_caller affects this kind of error. But ActionView::Template::Error is presented correctly by Better Errors as of release 2.7.1 when binding_of_caller is included. If you're not using binding_of_caller you'll see a duplicate backtrace frame.

Screen Shot 2020-05-13 at 13 53 37