Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/lib/error-reporting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ type SilenceReason =
| "auth_expected"
| "api_user_error"
| "api_query_error"
| "network_error";
| "network_error"
| "validation_error";

/**
* Classify whether an error should be silenced.
Expand Down Expand Up @@ -82,6 +83,15 @@ export function classifySilenced(error: unknown): SilenceReason | null {
if (error instanceof ContextError) {
return "context_missing";
}
// A ValidationError with field "positional" means the user passed the wrong
// number of positional arguments — a user invocation mistake, never a CLI
// bug. Silence only this sub-case; other ValidationError fields (e.g.
// "installUrl" from buildFormatFromUrl) may reflect API-contract issues
// worth capturing. The `cli.error.silenced` metric preserves the volume.
// (CLI-1AN)
if (error instanceof ValidationError && error.field === "positional") {
return "validation_error";
}
Comment thread
sentry[bot] marked this conversation as resolved.
// All AuthError reasons are expected auth states the user must act on, not
// CLI bugs: `not_authenticated` (no token), `expired` (token aged out), and
// `invalid` (a bad/insufficiently-scoped token the user supplied). `invalid`
Expand Down
Loading