makara icon indicating copy to clipboard operation
makara copied to clipboard

ErrorHandler#harshly no longer fails when backtrace nil

Open estraph opened this issue 5 years ago • 1 comments

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 avatar Mar 08 '19 21:03 estraph

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.

eugeneius avatar Mar 25 '19 15:03 eugeneius