Skip to content

Expose wrapper error #3

Open
Open
@bherw

Description

@bherw

Thanks for the great little library, it solves a lot of what we've been looking for.

It'd be useful if the withWrapper struct (and Wrapper interface) would expose the wrapper error. Right now, the format function produces something like this for nested errors:

Error: wrapper 2: wrapper 1: original error
Previous error: wrapper 1: original error
Previous error: original error

The testError in format_test.go displays roughly what I want, but only by implementing a different Error() function.

I'd also like to be able to enable/disable stacktraces while maintaining this list of causes; I'm fine with writing my own formatter, but I'd rather avoid replacing the wrappedError and xerrors.New constructor.

I'm happy to submit a PR if you're OK with this direction.

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