Skip to content
Open
Show file tree
Hide file tree
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
11 changes: 10 additions & 1 deletion packages/cli/src/lib/error-reporting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {
ApiError,
AuthError,
CliError,
ConfigError,
ContextError,
DeviceFlowError,
HostScopeError,
Expand All @@ -54,7 +55,8 @@ type SilenceReason =
| "output_error"
| "auth_expected"
| "api_user_error"
| "network_error";
| "network_error"
| "config_error";

/**
* Classify whether an error should be silenced.
Expand Down Expand Up @@ -94,6 +96,13 @@ export function classifySilenced(error: unknown): SilenceReason | null {
if (error instanceof ApiError && error.status > 400 && error.status < 500) {
return "api_user_error";
}
// A ConfigError means the user did not provide a required configuration value
// (e.g. no DSN via --dsn or SENTRY_DSN). This is expected user
// misconfiguration, not a CLI bug — silencing it removes noise from
// telemetry while the `cli.error.silenced` metric preserves volume (CLI-28M).
if (error instanceof ConfigError) {
return "config_error";
}
// A 400 (Bad Request) signals a malformed request the CLI built — a code
// defect — so it is always captured. A user's unparseable `--query` is NOT a
// 400 here: it is converted to a ValidationError at the command boundary
Expand Down
7 changes: 6 additions & 1 deletion packages/cli/test/lib/error-reporting.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,11 +305,16 @@ describe("classifySilenced", () => {
],
["ValidationError", new ValidationError("bad")],
["SeerError", new SeerError("not_enabled")],
["ConfigError", new ConfigError("bad")],
["generic Error", new Error("boom")],
])("does NOT silence %s", (_label, err) => {
expect(classifySilenced(err)).toBeNull();
});

test("silences ConfigError as config_error (CLI-28M)", () => {
// ConfigError means the user omitted a required config value (e.g. no DSN).
// It is user misconfiguration, not a CLI bug — silence it to reduce noise.
expect(classifySilenced(new ConfigError("bad"))).toBe("config_error");
});
});

// ---------------------------------------------------------------------------
Expand Down
Loading