Skip to content

Behavior change on Event.Err with commit f6fbd33 #762

@ouamer-dahmani

Description

@ouamer-dahmani

Hello!

I upgraded from zerolog v1.31.0 to v1.35.0 and some of my tests validating log format started failing. I use the https://github.com/elastic/ecs-logging-go-zerolog library to enforce a formatting standard and saw that the error messages stopped appearing.

I tracked the issue to this commit:
f6fbd33#diff-552f47512a00afe5fc6850cc9ddc830a6daeca162750e50aab4ed549685e0253R187

Before, when ErrorStackMarshaller(err).(type) returned nil we would fall through the switch case and execute return e.AnErr(ErrorFieldName, err). This ensured that a regular error without stack wrapping would still get marshalled.

After the commit, the function started returning the event unchanged, as if the error was nil which is not the case. How should I deal with this behaviour change?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions