MCPcopy Create free account
hub / github.com/algolia/cli / ErrorClass

Function ErrorClass

pkg/telemetry/events.go:314–327  ·  view source on GitHub ↗

ErrorClass returns the type of the first informative error of the chain, skipping the anonymous wrappers created by fmt.Errorf. It never returns an error message, which could contain user data.

(err error)

Source from the content-addressed store, hash-verified

312// skipping the anonymous wrappers created by fmt.Errorf. It never returns an
313// error message, which could contain user data.
314func ErrorClass(err error) string {
315 for err != nil {
316 class := fmt.Sprintf("%T", err)
317 switch class {
318 case "*fmt.wrapError", "*fmt.wrapErrors", "*errors.joinError":
319 if unwrapped := errors.Unwrap(err); unwrapped != nil {
320 err = unwrapped
321 continue
322 }
323 }
324 return class
325 }
326 return ""
327}

Callers 7

trackCommandCompletedFunction · 0.92
TestErrorClass_NilErrorFunction · 0.85
AuthFailedFunction · 0.85
ApplicationCreateFailedFunction · 0.85

Calls 1

UnwrapMethod · 0.45