(err error)
| 15 | ) |
| 16 | |
| 17 | func ExitCodeFor(err error) int { |
| 18 | var e *Error |
| 19 | if !errors.As(err, &e) { |
| 20 | return 1 |
| 21 | } |
| 22 | switch e.Code { |
| 23 | case "usage": |
| 24 | return ExitUsage |
| 25 | case "not_found": |
| 26 | return ExitNotFound |
| 27 | case "auth": |
| 28 | return ExitAuth |
| 29 | case "forbidden": |
| 30 | return ExitForbidden |
| 31 | case "rate_limit": |
| 32 | return ExitRateLimit |
| 33 | case "network": |
| 34 | return ExitNetwork |
| 35 | case "api": |
| 36 | return ExitAPI |
| 37 | case "ambiguous": |
| 38 | return ExitAmbiguous |
| 39 | default: |
| 40 | return 1 |
| 41 | } |
| 42 | } |
no outgoing calls