-
-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Context
PR review comment from @AustinBYK: the exit code pattern used by sentry init is great and should be spread across the entire CLI, with documentation on the docs site.
Current state
- Only
sentry inituses structured exit codes; every other command exits 0 or 1 CliErrorbase class (src/lib/errors.ts) has anexitCodeproperty but no subclass overrides it — all errors default to 1- Init wizard defines 4 constants in
src/lib/init/constants.ts(10, 20, 30, 50) with 2 more used server-side only (40, 41)
Existing init exit codes
| Code | Meaning | Where defined |
|---|---|---|
| 0 | Success | open-sentry-ui step |
| 10 | Sentry already installed | check-existing-sentry step |
| 20 | Platform not detected | detect-platform step |
| 30 | Dependency install failed | install-deps step |
| 40 | Codemod plan failed | plan-codemods step (server-side only) |
| 41 | Codemod apply failed | apply-codemods step (server-side only) |
| 50 | User stopped after verification | verify-changes step |
Proposal
- Define semantic exit code ranges for the whole CLI (e.g. 1=general, 2=usage/args, 10–19=auth, 20–29=config, etc.)
- Have
CliErrorsubclasses set appropriate exit codes (e.g.AuthError→ 10,ConfigError→ 20) - Add a reference page to the docs site listing all exit codes so users can script around them
- Backward-compatible — currently everything is 0 or 1, so adding specific codes is purely additive
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels