MCPcopy Create free account
hub / github.com/auth0/auth0-cli / classifyCommandFailure

Function classifyCommandFailure

internal/cli/root.go:349–371  ·  view source on GitHub ↗
(err error)

Source from the content-addressed store, hash-verified

347}
348
349func classifyCommandFailure(err error) map[string]string {
350 properties := map[string]string{
351 "success": "false",
352 "error_class": "unknown",
353 }
354
355 if errors.Is(err, config.ErrInvalidToken) || errors.Is(err, config.ErrMalformedToken) {
356 properties["error_class"] = "auth"
357 return properties
358 }
359
360 var missingScopesErr config.ErrTokenMissingRequiredScopes
361 if errors.As(err, &missingScopesErr) {
362 properties["error_class"] = "auth"
363 return properties
364 }
365
366 if status, ok := managementHTTPStatus(err); ok {
367 properties["error_class"] = errorClassForHTTPStatus(status)
368 }
369
370 return properties
371}
372
373// managementHTTPStatus extracts the HTTP status from a go-auth0 management API
374// error anywhere in the error chain, supporting both the v1 (management.Error)

Callers 2

trackCommandOutcomeFunction · 0.85

Calls 2

managementHTTPStatusFunction · 0.85
errorClassForHTTPStatusFunction · 0.85

Tested by 1