cockroachdb / cockroachdb/errors

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

オープン
#162 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Go
スター
2.5k
フォーク
74
PR マージ指標
30日以内にマージされた PR はありません

説明

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?

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。