{{ message }}
refactor(errors): unify error hierarchy with ContextError pattern#21
Merged
Conversation
Add ContextError class for consistent "missing context" error messages across all commands, following gh CLI patterns. Changes: - Add ContextError to error hierarchy in lib/errors.ts - Remove positional arg from `project list` (breaking change) - Update all get/list commands to use ContextError - Update tests for new `--org` flag syntax BREAKING CHANGE: `sentry project list <org>` no longer works. Use `sentry project list --org <org>` instead. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Documents the CLI command conventions for future contributors: - List vs get command patterns - Context resolution order (flags > config > DSN) - Common flags reference - ContextError usage for consistent errors Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Update error messages to mention both auto-detection options: - Run from a directory with a Sentry-configured project - Set SENTRY_DSN environment variable Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…constant Add DEFAULT_CONTEXT_ALTERNATIVES constant in errors.ts and use it as the default value for ContextError constructor. This removes repeated alternatives arrays from 5 command files. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add null checks for optional Sentry API fields (level, status, project, metadata, tags, dateCreated, etc.) - Fix Stricli flag configs: use placeholder instead of variableName, remove optional from variadic flags, use string defaults for numberParser - Cast this.process to NodeJS.Process for exitCode access - Update formatStatusIcon/formatStatusLabel to accept undefined Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
BYK
added a commit
that referenced
this pull request
Jun 23, 2026
Fixes 5 open Dependabot alerts: | Alert | Package | Severity | Fix | |-------|---------|----------|-----| | #10 | vite@8.0.13 (fs.deny bypass) | High | → 8.0.16 | | #9 | vite@8.0.13 (NTLM hash leak) | Moderate | → 8.0.16 | | #22 | form-data@4.0.5 (CRLF injection) | Moderate | → 4.0.6 | | #14 | js-yaml@4.1.1 docs (DoS) | Moderate | → 4.2.0 | | #13 | @babel/core@7.29.0 docs (arbitrary file read) | Low | → 7.29.6 | **Accepted as tolerable risk:** - Alert #21: js-yaml@3.14.2 in main lockfile — `gray-matter` pins `^3.13.1` with no v3 patch backport; dev-only transitive dep used at build time All patches applied via `pnpm.overrides` in respective `package.json` files. `check:deps` ✓, `lint` ✓, `typecheck` has a pre-existing unrelated error in `src/commands/api.ts`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Standardizes error handling across all CLI commands using a unified error hierarchy. Introduces
ContextErrorfor missing context (org, project) with consistent formatting and helpful suggestions, plus Zod schemas for API response validation.Changes
lib/errors.tswithCliError,AuthError,ApiError, andContextErrorclassesContextErrorfor missing org/project contextwriteJson,writeLines) for consistent formattingTest plan
npm run typecheckpasses with no errorsnpm run buildcompletes successfully🤖 Generated with Claude Code