cockroachdb / cockroachdb/errors

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

Open
#162 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
2.5k
Forks
74
PR merge metrics
No merged PRs in 30d

Description

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?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.