More info about unreported fatal errors #15807
Open
+72
−24
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Another iteration on #15185.
In #15185 I replaced rethrowing of unreported fatal errors with an assert. Back then it was pointed out that we're losing extra detail by doing that (#15185 (comment)). I thought it didn't matter because this kind of bug should be pretty uncommon and even then fixed quickly but some recent reports proved me wrong (#15600, #15601, #15722). This happens more often than I thought and apparently no one notices that this way of reporting a fatal error is a bug in itself so we're better off having that extra info there.
To be fair, I did add more info to the output back then - the message from the original exception - which should have been enough to avoid this. The problem is that
ErrorReporter
does not provide that message, probably assuming that the message inError
is what matters and the one from the exception will never be shown. The only thing we get is the exception type which often tells us nothing (it's juststd::exception
in all the linked cases).I still don't think we should just rethrow an exception that someone might assume has to be handled. The PR fixes the issue by keeping the assert but also immediately reporting all the details about the
FatalError
at the point where it's caught. It also adds messages to allFatalError
s: both those thrown byErrorReporter
and a few cases where we throw them manually.