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

Function encodePkgWithStack

errbase/adapters.go:77–83  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

75// it as an opaqueWrapper instance in this package.
76
77func 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
85func encodePathError(
86 _ context.Context, err error,

Callers

nothing calls this directly

Calls 1

StackTraceMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…