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

Function encodeAsAny

errbase/encode.go:114–128  ·  view source on GitHub ↗
(ctx context.Context, err error, payload proto.Message)

Source from the content-addressed store, hash-verified

112}
113
114func encodeAsAny(ctx context.Context, err error, payload proto.Message) *types.Any {
115 if payload == nil {
116 return nil
117 }
118
119 any, marshalErr := types.MarshalAny(payload)
120 if marshalErr != nil {
121 warningFn(ctx,
122 "error %+v (%T) announces proto message, but marshaling fails: %+v",
123 err, err, marshalErr)
124 return nil
125 }
126
127 return any
128}
129
130// encodeWrapper encodes an error wrapper.
131func encodeWrapper(ctx context.Context, err, cause error) EncodedError {

Callers 2

encodeLeafFunction · 0.85
encodeWrapperFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…