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

Function RegisterMultiCauseEncoder

errbase/encode.go:360–368  ·  view source on GitHub ↗

RegisterMultiCauseEncoder can be used to register new multi-cause error types to the library. Registered types will be encoded using their own Go type when an error is encoded. Multi-cause wrappers that have not been registered will be encoded using the opaqueWrapper type.

(theType TypeKey, encoder MultiCauseEncoder)

Source from the content-addressed store, hash-verified

358// that have not been registered will be encoded using the
359// opaqueWrapper type.
360func RegisterMultiCauseEncoder(theType TypeKey, encoder MultiCauseEncoder) {
361 // This implementation is a simple wrapper around `LeafEncoder`
362 // because we implemented multi-cause error wrapper encoding into a
363 // `Leaf` instead of a `Wrapper` for smoother backwards
364 // compatibility support. Exposing this detail to consumers of the
365 // API is confusing and hence avoided. The causes of the error are
366 // encoded separately regardless of this encoder's implementation.
367 RegisterLeafEncoder(theType, encoder)
368}
369
370// MultiCauseEncoder is to be provided (via RegisterMultiCauseEncoder
371// above) by additional multi-cause wrapper types not yet known to this

Callers 3

initFunction · 0.92
initFunction · 0.92

Calls 1

RegisterLeafEncoderFunction · 0.70

Tested by 1

initFunction · 0.74

Used in the wild real call sites across dependent graphs

searching dependent graphs…