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

Exception#cause difference with CRuby #4239

Open
nateberkopec opened this issue Oct 20, 2016 · 3 comments
Open

Exception#cause difference with CRuby #4239

nateberkopec opened this issue Oct 20, 2016 · 3 comments

Comments

@nateberkopec
Copy link

Environment

JRuby 9.1.5.0
All platforms

Expected Behavior

def build_exception_with_cause
  begin
    1 / 0
  rescue ZeroDivisionError
    1 / 0
  end
rescue ZeroDivisionError => exception
  return exception
end

exc = build_exception_with_cause
exc.cause # MRI: #<ZeroDivisionError: divided by 0>

Actual Behavior

exc = build_exception_with_cause
exc.cause # JRuby: nil
@headius
Copy link
Member

headius commented Oct 20, 2016

Confirmed on master. Does not have to be two ZeroDivisionError either. We're just not setting cause when raising a new ZeroDivisionError, probably because we don't call through Kernel.raise.

@headius
Copy link
Member

headius commented Oct 20, 2016

Hey, can I ask how critical this is? The paths along which we construct exceptions to be raised from within JRuby share a lot with the paths for raising an exception from Ruby, so fixing this in the short term will require a fair bit of untangling. We need to fix it obviously, but if it's something we can punt until after RubyConf/9.1.6.0 it would be better.

@nateberkopec
Copy link
Author

Pretty minor. It was used in our test suite for sentry-raven, but we can work around it by just constructing Exceptions via raise.

In the meantime, anyone who uses an exception reporting service that reports cause, like ours, will just receive slightly inaccurate reports.

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

No branches or pull requests

2 participants