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

Function RegisterWrapperEncoder

errbase/encode.go:385–397  ·  view source on GitHub ↗

RegisterWrapperEncoder can be used to register new wrapper types to the library. Registered wrappers will be encoded using their own Go type when an error is encoded. Wrappers that have not been registered will be encoded using the opaqueWrapper type. Note: if the error type has been migrated from

(theType TypeKey, encoder WrapperEncoder)

Source from the content-addressed store, hash-verified

383// or a different type, ensure that RegisterTypeMigration() was called
384// prior to RegisterWrapperEncoder().
385func RegisterWrapperEncoder(theType TypeKey, encoder WrapperEncoder) {
386 RegisterWrapperEncoderWithMessageType(
387 theType,
388 func(ctx context.Context, err error) (
389 msgPrefix string,
390 safeDetails []string,
391 payload proto.Message,
392 messageType MessageType,
393 ) {
394 prefix, details, payload := encoder(ctx, err)
395 return prefix, details, payload, messageType
396 })
397}
398
399// RegisterWrapperEncoderWithMessageType can be used to register
400// new wrapper types to the library. Registered wrappers will be

Callers 11

RegisterWrapperEncoderFunction · 0.92
initFunction · 0.92
initFunction · 0.92
initFunction · 0.92
initFunction · 0.92
initFunction · 0.92
initFunction · 0.92
initFunction · 0.92
initFunction · 0.92
initFunction · 0.70

Tested by 1

Used in the wild real call sites across dependent graphs

searching dependent graphs…