MCPcopy Index your code
hub / github.com/larksuite/cli / ExitCodeOf

Function ExitCodeOf

internal/output/exitcode.go:54–70  ·  view source on GitHub ↗

ExitCodeOf returns the shell exit code for any error. - typed errors (*errs.PermissionError, *errs.APIError, *errs.ConfigError, *errs.AuthenticationError, ...) → routed by Category - *PartialFailureError / *BareError signals → their own Code field - untyped → ExitInternal

(err error)

Source from the content-addressed store, hash-verified

52// - *PartialFailureError / *BareError signals → their own Code field
53// - untyped → ExitInternal
54func ExitCodeOf(err error) int {
55 if err == nil {
56 return ExitOK
57 }
58 if _, ok := errs.ProblemOf(err); ok {
59 return ExitCodeForCategory(errs.CategoryOf(err))
60 }
61 var pfErr *PartialFailureError
62 if errors.As(err, &pfErr) {
63 return pfErr.Code
64 }
65 var bare *BareError
66 if errors.As(err, &bare) {
67 return bare.Code
68 }
69 return ExitInternal
70}

Calls 4

ProblemOfFunction · 0.92
CategoryOfFunction · 0.92
ExitCodeForCategoryFunction · 0.85
AsMethod · 0.80