MCPcopy Create free account
hub / github.com/cockroachdb/errors / getMark

Function getMark

markers/markers.go:196–208  ·  view source on GitHub ↗

getMark computes a marker for the given error.

(err error)

Source from the content-addressed store, hash-verified

194
195// getMark computes a marker for the given error.
196func getMark(err error) errorMark {
197 if m, ok := err.(*withMark); ok {
198 return m.mark
199 }
200 m := errorMark{
201 msg: safeGetErrMsg(err),
202 types: []errorspb.ErrorTypeMark{errbase.GetTypeMark(err)},
203 }
204 for c := errbase.UnwrapOnce(err); c != nil; c = errbase.UnwrapOnce(c) {
205 m.types = append(m.types, errbase.GetTypeMark(c))
206 }
207 return m
208}
209
210// safeGetErrMsg extracts an error's Error() but tolerates panics.
211func safeGetErrMsg(err error) (result string) {

Callers 2

isMarkEqualFunction · 0.85
MarkFunction · 0.85

Calls 3

GetTypeMarkFunction · 0.92
UnwrapOnceFunction · 0.92
safeGetErrMsgFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…