Skip to content

Commit

Permalink
Merge pull request #430 from RobinDaugherty/fix/nomethoderror-in-jbui…
Browse files Browse the repository at this point in the history
…lder

Fix NoMethodError when variables cannot be retrieved from the stack frame
  • Loading branch information
RobinDaugherty committed Jul 9, 2019
2 parents 34df3eb + 679b7de commit 1891ad8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/better_errors/stack_frame.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ def pretty_path
def local_variables
return {} unless frame_binding

frame_binding.eval("local_variables").each_with_object({}) do |name, hash|
lv = frame_binding.eval("local_variables")
return {} unless lv

lv.each_with_object({}) do |name, hash|
# Ruby 2.2's local_variables will include the hidden #$! variable if
# called from within a rescue context. This is not a valid variable name,
# so the local_variable_get method complains. This should probably be
Expand All @@ -94,7 +97,10 @@ def instance_variables
end

def visible_instance_variables
frame_binding.eval("instance_variables") - BetterErrors.ignored_instance_variables
iv = frame_binding.eval("instance_variables")
return {} unless iv

iv - BetterErrors.ignored_instance_variables
end

def to_s
Expand Down

0 comments on commit 1891ad8

Please sign in to comment.