MCPcopy Index your code
hub / github.com/cockroachdb/errors / encodePkgFundamental

Function encodePkgFundamental

errbase/adapters.go:51–58  ·  view source on GitHub ↗

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,
)

Source from the content-addressed store, hash-verified

49// it as an opaqueLeaf instance in this package.
50
51func 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

Callers

nothing calls this directly

Calls 2

StackTraceMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…