This repository has been archived by the owner on Jun 1, 2024. It is now read-only.
Fix log events not being written to Sink when exception has no stacktrace #285
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.
What issue does this PR address?
#281 - Log Events not Written to Sink with Inner Exceptions.
Does this PR introduce a breaking change?
No
Please check if the PR fulfills these requirements
Other information:
A null reference exception was thrown when trying to format Exception with no stacktrace (either root or inner one). This caused log events not to be written to the Sink.
This only happens, when someone tries to log an exception that wasn't thrown, but created via the
new
keyword. The latter one has most properties set tonull
because it was not thrown. While it's rare that such instance of the Exception class is used, the formatter should still be able to handle it gently.I think that when
formatStackTraceAsArray
is enabled, theStackTrace
andRemoteStackTrace
Exception properties, whennull
, should be formatted as empty arrays.