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

ErrorHandler#harshly no longer fails when backtrace nil #229

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

estraph
Copy link

@estraph estraph commented Mar 8, 2019

When an exception doesn't have a backtrace (it is nil), the harshly method can blow up, masking the underlying exception with this instead:

NoMethodError: undefined method `join' for nil:NilClass

This PR updates the call to join to use the safe navigation operator which will result in the backtrace in the message being empty, and allowing harshly to re-raise the original exception as intended.

@estraph estraph force-pushed the raph/harshly branch 2 times, most recently from ddd2424 to a1e7cc7 Compare March 8, 2019 21:36
@eugeneius
Copy link

eugeneius commented Mar 25, 2019

Based on .travis.yml, it looks like this gem supports Ruby 2.0 and above:

https://github.com/taskrabbit/makara/blob/01195ef2dfd258a53786a4a30a9cbc2aff581e2e/.travis.yml#L19-L26

The safe navigation operator was only added in Ruby 2.3, so we can't use it here.

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

Successfully merging this pull request may close these issues.

2 participants