Skip to content

Commit

Permalink
add workaround for BetterErrors#351
Browse files Browse the repository at this point in the history
  • Loading branch information
glebtv committed Jan 30, 2018
1 parent 946281d commit 6d00365
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/better_errors/stack_frame.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,11 @@ def local_variables
next if name == :"\#$!"

if defined?(frame_binding.local_variable_get)
hash[name] = frame_binding.local_variable_get(name)
begin
hash[name] = frame_binding.local_variable_get(name)
rescue Exception => e

This comment has been minimized.

Copy link
@pdobb

pdobb Feb 1, 2018

Note: rescue NameError => e is better. (See https://blog.honeybadger.io/ruby-exception-vs-standarderror-whats-the-difference/)

Thanks! I've hacked my local gem copy to use the above code and it makes it possible to view source on Exhibits (from the display_case gem).

hash[name] = "Error reading variable #{name}: #{e.class.name}: #{e.message}"
end
else
hash[name] = frame_binding.eval(name.to_s)
end
Expand Down

0 comments on commit 6d00365

Please sign in to comment.