errors.withStack 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 opaqueWrapper instance in this package.
( _ context.Context, err error, )
| 75 | // it as an opaqueWrapper instance in this package. |
| 76 | |
| 77 | func encodePkgWithStack( |
| 78 | _ context.Context, err error, |
| 79 | ) (msgPrefix string, safe []string, _ proto.Message) { |
| 80 | iErr := err.(interface{ StackTrace() pkgErr.StackTrace }) |
| 81 | safeDetails := []string{fmt.Sprintf("%+v", iErr.StackTrace())} |
| 82 | return "" /* withStack does not have a message prefix */, safeDetails, nil |
| 83 | } |
| 84 | |
| 85 | func encodePathError( |
| 86 | _ context.Context, err error, |
nothing calls this directly
no test coverage detected
searching dependent graphs…