errors.fundamental from github.com/pkg/errors cannot be encoded exactly because it includes a non-serializable stack trace object. In order to work with it, we encode it by dumping the stack trace in a safe reporting detail field, and decode it as an opaqueLeaf instance in this package.
( _ context.Context, err error, )
| 49 | // it as an opaqueLeaf instance in this package. |
| 50 | |
| 51 | func encodePkgFundamental( |
| 52 | _ context.Context, err error, |
| 53 | ) (msg string, safe []string, _ proto.Message) { |
| 54 | msg = err.Error() |
| 55 | iErr := err.(interface{ StackTrace() pkgErr.StackTrace }) |
| 56 | safeDetails := []string{fmt.Sprintf("%+v", iErr.StackTrace())} |
| 57 | return msg, safeDetails, nil |
| 58 | } |
| 59 | |
| 60 | // errors.withMessage from github.com/pkg/errors can be encoded |
| 61 | // exactly because it just has a message prefix. The base encoding |
nothing calls this directly
no test coverage detected
searching dependent graphs…