event: restore Err() logging when ErrorStackMarshaler returns nil#763
Merged
Conversation
Commit f6fbd33 added `case nil: return e` in Event.Err() so that when ErrorStackMarshaler returns nil (the error has no stack trace), the function returns early without logging the error itself. This was a regression. The previous behaviour was to fall through the switch and always call AnErr(ErrorFieldName, err), ensuring the error message is logged even when no stack is attached. Libraries such as elastic/ecs-logging-go-zerolog (and plain fmt.Errorf errors) rely on the old behaviour: calling Stack().Err(err) should always log the error field; the stack field is additional and optional. Change the `nil` case from `return e` to a comment (fall-through) so that AnErr is called unconditionally. Update the test that was written to match the incorrect behaviour. Fixes rs#762 Signed-off-by: alliasgher <alliasgher123@gmail.com>
IDisposable
approved these changes
Apr 20, 2026
Contributor
|
This one only reverts one of the changes, probably should prefer #758 |
This was referenced Apr 21, 2026
peiman
added a commit
to peiman/vaultmind
that referenced
this pull request
Apr 22, 2026
Patch-level bug fix: restore Err() logging when ErrorStackMarshaler returns nil (rs/zerolog#763). task check: all 23 green. Addresses 1 of 2 updates in dependabot #13; hugot 0.7.0 → 0.7.1 remains deferred (unexports Preprocess/Forward which breaks BGE-M3).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #762. Commit f6fbd33 introduced a 'case nil: return e' that drops the error field entirely when ErrorStackMarshaler returns nil. This restores the original behaviour of always calling AnErr even when no stack is attached.