rspec / rspec-core

RSpec runner and formatters
http://rspec.info
MIT License
1.23k stars 765 forks source link

Do not fail if an Exception has no backtrace #2903

Closed zinovyev closed 3 years ago

zinovyev commented 3 years ago

Currently backtrace of an exception is checked by the empty? method. But it sometimes occur that the Exception class will return nil for backtrace:

StandardError.new.backtrace.empty?
NoMethodError: undefined method `empty?' for nil:NilClass
JonRowe commented 3 years ago

:wave: we would need a test indicating how this can occur

zinovyev commented 3 years ago

wave we would need a test indicating how this can occur

@JonRowe sure! I've added a test for this case.

zinovyev commented 3 years ago

Perfect, thank you. Would you like to add a Changelog entry?

@pirj Thank you! Should I add a Changelog entry manually? Sorry I'm not completely aware of the process. I just read that in development docs:

No changelog entry is necessary (we'll add it as part of the merge process!)

Do I only need to provide a change log message or am I also supposed to add it to the CHANGELOG.md file? I would call it something like: "Prevent ExceptionPresenter failure when handling an error with a nil backtrace"

pirj commented 3 years ago

No changelog entry is necessary (we'll add it as part of the merge process!)

Oh, sorry to bother. It slipped my mind. :+1:

zinovyev commented 3 years ago

Thank you guys for your reviews and for being so helpful! Do you think that we can merge it now? It looks like I don't have the permission to do it by myself. Or will it just be merged automatically in some time?

pirj commented 3 years ago

I'll handle this later in the day.

pirj commented 3 years ago

Thanks for your contribution!