Skip to content

Supporting Go 1.13+ wrapped errors #7

Open
@wttw

Description

Go 1.13 supports wrapping errors in a standard way.

tracerr doesn't print stack traces of wrapped errors, as it doesn't know how to look inside to see the wrapped error is a tracerr.Error.

Changing the test in print.go from

        e, ok := err.(Error)
	if !ok {
		return err.Error()
	}

to

        var e Error
	if !errors.As(err, &e) {
		return err.Error()
	}

It's a fairly trivial change, but does mean that it won't compile with Go 1.12 or earlier, without some minor refactoring and build flags.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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