Skip to content

We should embed errors when reporting upwards #657

@tobsan

Description

@tobsan

A common code path is something like:

val, err := SomeFunc(somearg)
if err != nil {
    return fmt.Errorf("Couldn't do some thing with %s", somearg)
}

However, in doing that we lose some error context, because we throw away the actual error message from SomeFunc. A better way would be to do the below, which we ideally should do everywhere.

return fmt.Errorf("Couldn't do some thing with %s: %w", somearg, err)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions