RegisterLeafEncoder can be used to register new leaf error types to the library. Registered types will be encoded using their own Go type when an error is encoded. Wrappers that have not been registered will be encoded using the opaqueLeaf type. Note: if the error type has been migrated from a prev
(theType TypeKey, encoder LeafEncoder)
| 338 | // or a different type, ensure that RegisterTypeMigration() was called |
| 339 | // prior to RegisterLeafEncoder(). |
| 340 | func RegisterLeafEncoder(theType TypeKey, encoder LeafEncoder) { |
| 341 | if encoder == nil { |
| 342 | delete(leafEncoders, theType) |
| 343 | } else { |
| 344 | leafEncoders[theType] = encoder |
| 345 | } |
| 346 | } |
| 347 | |
| 348 | // LeafEncoder is to be provided (via RegisterLeafEncoder above) |
| 349 | // by additional wrapper types not yet known to this library. |
no outgoing calls
searching dependent graphs…