Skip to content

Errors returned from Join are incompatible with errors returned the standard lib's errors.Join #162

@kderh

Description

@kderh

The standard errors package uses the following example to extract the individual sub-errors from the result err of calling Join:

https://pkg.go.dev/errors#Join
fmt.Println(err.(interface{ Unwrap() []error }).Unwrap())

This is not possible with return values of Join:
panic: interface conversion: *withstack.withStack is not interface { Unwrap() []error }: missing method Unwrap

However the code needed to do the same is, unintuitively:
fmt.Println(err.(interface{ Unwrap() error }).Unwrap().(interface{ Unwrap() []error }).Unwrap())

Or is there a better way do it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions