Skip to content

Commit 063113b

Browse files
authored
chore(cli): temporarily disable Sentry reporting for unclassified errors (#14750)
## Description Part of the CLI error classification effort — see #14749 for full context. Temporarily suppresses Sentry reporting for errors that haven't been classified yet. This is a safety net so that merging #14749 doesn't flood Sentry with noise while the ~35 follow-up package migration PRs are landing. ## Changes Made - Added `UNCLASSIFIED` to `CliError.Code` - Default error code fallback changed from `INTERNAL_ERROR` to `UNCLASSIFIED` in: - `cli.ts` (CLI v1 top-level catch) - `CliContext.ts` (CLI v1 task runner) - `withContext.ts` → `reportError` (CLI v2) - `UNCLASSIFIED` is **not** in `SENTRY_REPORTABLE_CODES`, so these errors are silently tracked in PostHog but not sent to Sentry ## Rollback Once all package migration PRs have landed, #14752 will remove `UNCLASSIFIED` and revert the fallback to `INTERNAL_ERROR`. ## Testing - [x] Existing tests pass (only changes default string literals)
1 parent 429be56 commit 063113b

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

packages/cli/cli/src/cli-context/TaskContextImpl.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
TaskContext,
1313
TaskResult
1414
} from "@fern-api/task-context";
15+
1516
import chalk from "chalk";
1617

1718
import { reportError } from "../telemetry/reportError.js";

packages/cli/task-context/src/CliError.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ export namespace CliError {
5757
ValidationError: "VALIDATION_ERROR",
5858
NetworkError: "NETWORK_ERROR",
5959
AuthError: "AUTH_ERROR",
60-
ConfigError: "CONFIG_ERROR"
60+
ConfigError: "CONFIG_ERROR",
61+
Unclassified: "UNCLASSIFIED"
6162
} as const;
6263
}
6364

@@ -73,7 +74,8 @@ const SENTRY_REPORTABLE: Record<CliError.Code, boolean> = {
7374
[CliError.Code.ValidationError]: false,
7475
[CliError.Code.NetworkError]: false,
7576
[CliError.Code.AuthError]: false,
76-
[CliError.Code.ConfigError]: false
77+
[CliError.Code.ConfigError]: false,
78+
[CliError.Code.Unclassified]: false
7779
};
7880

7981
export function shouldReportToSentry(code: CliError.Code): boolean {
@@ -93,7 +95,8 @@ function isNodeVersionError(error: unknown): boolean {
9395
/**
9496
* Resolves the effective error code: explicit override wins,
9597
* then auto-detects from known error types,
96-
* and falls back to INTERNAL_ERROR for truly unknown errors.
98+
* and falls back to UNCLASSIFIED for unknown errors until all packages
99+
* are migrated to the new error system.
97100
*/
98101
export function resolveErrorCode(error: unknown, explicitCode?: CliError.Code): CliError.Code {
99102
if (explicitCode != null) {
@@ -108,5 +111,5 @@ export function resolveErrorCode(error: unknown, explicitCode?: CliError.Code):
108111
if (isNodeVersionError(error)) {
109112
return CliError.Code.EnvironmentError;
110113
}
111-
return CliError.Code.InternalError;
114+
return CliError.Code.Unclassified;
112115
}

0 commit comments

Comments
 (0)