diff --git a/lib/better_errors/stack_frame.rb b/lib/better_errors/stack_frame.rb index 46518031..467f095f 100644 --- a/lib/better_errors/stack_frame.rb +++ b/lib/better_errors/stack_frame.rb @@ -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 + hash[name] = "Error reading variable #{name}: #{e.class.name}: #{e.message}" + end else hash[name] = frame_binding.eval(name.to_s) end