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

Function EqualTypeMark

errbase/encode.go:311–330  ·  view source on GitHub ↗

EqualTypeMark checks whether `GetTypeMark(e1).Equals(GetTypeMark(e2))`. It is written to be be optimized for the case where neither error has serialized type information.

(e1, e2 error)

Source from the content-addressed store, hash-verified

309// is written to be be optimized for the case where neither error has
310// serialized type information.
311func EqualTypeMark(e1, e2 error) bool {
312 slowPath := func(err error) bool {
313 switch err.(type) {
314 case *opaqueLeaf:
315 return true
316 case *opaqueLeafCauses:
317 return true
318 case *opaqueWrapper:
319 return true
320 case TypeKeyMarker:
321 return true
322 }
323 return false
324 }
325 if slowPath(e1) || slowPath(e2) {
326 return GetTypeMark(e1).Equals(GetTypeMark(e2))
327 }
328
329 return reflect.TypeOf(e1) == reflect.TypeOf(e2)
330}
331
332// RegisterLeafEncoder can be used to register new leaf error types to
333// the library. Registered types will be encoded using their own

Callers 1

isMarkEqualFunction · 0.92

Calls 2

GetTypeMarkFunction · 0.85
EqualsMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…