Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: how to get the binding where the exception originally occurred? #64

Closed
brauliobo opened this issue Jun 17, 2017 · 2 comments
Closed

Comments

@brauliobo
Copy link

brauliobo commented Jun 17, 2017

When rescuing exceptions in of other instances, I would like to open pry at the binding of the instance that caused the exception, not where it was rescued. An example:

begin
  yield
rescue => e
  require 'pry'; yield_binding.pry
end

How to do it?

@brauliobo
Copy link
Author

Just figured it out, no need for binding_of_caller in this case.

begin
  block.call
rescue => e
  require 'pry'; block.binding.pry
end

@brauliobo
Copy link
Author

Still couldn't get exact object that caused and raised the exception, this was the closer I could get: https://stackoverflow.com/a/44610731/670229 from http://docs.honeybadger.io/ruby/exceptions/extending-ruby-exceptions.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant