Skip to content

Commit fd585dd

Browse files
committed
chore(cli): temporarily disable Sentry reporting for unclassified errors
Add UNCLASSIFIED code to CliError.Code and use it for catch-all error handlers in cli.ts, CliContext.ts, and withContext.ts. Generic Error instances that are not explicitly classified will no longer be reported to Sentry, reducing noise while we migrate utility packages away from CliError. Made-with: Cursor
1 parent cc732f3 commit fd585dd

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ export const CliErrorCode = {
1010
ValidationError: "VALIDATION_ERROR",
1111
NetworkError: "NETWORK_ERROR",
1212
AuthError: "AUTH_ERROR",
13-
ConfigError: "CONFIG_ERROR"
13+
ConfigError: "CONFIG_ERROR",
14+
Unclassified: "UNCLASSIFIED"
1415
} as const;
1516

1617
export type CliErrorCode = (typeof CliErrorCode)[keyof typeof CliErrorCode];
@@ -27,7 +28,8 @@ const SENTRY_REPORTABLE: Record<CliErrorCode, boolean> = {
2728
VALIDATION_ERROR: false,
2829
NETWORK_ERROR: false,
2930
AUTH_ERROR: false,
30-
CONFIG_ERROR: false
31+
CONFIG_ERROR: false,
32+
UNCLASSIFIED: false
3133
};
3234

3335
export function shouldReportToSentry(code: CliErrorCode): boolean {
@@ -47,7 +49,8 @@ function isNodeVersionError(error: unknown): boolean {
4749
/**
4850
* Resolves the effective error code: explicit override wins,
4951
* then auto-detects from known error types,
50-
* and falls back to INTERNAL_ERROR for truly unknown errors.
52+
* and falls back to UNCLASSIFIED for unknown errors until all packages
53+
* are migrated to the new error system.
5154
*/
5255
export function resolveErrorCode(error: unknown, explicitCode?: CliErrorCode): CliErrorCode {
5356
if (explicitCode != null) {
@@ -62,7 +65,7 @@ export function resolveErrorCode(error: unknown, explicitCode?: CliErrorCode): C
6265
if (isNodeVersionError(error)) {
6366
return "ENVIRONMENT_ERROR";
6467
}
65-
return "INTERNAL_ERROR";
68+
return "UNCLASSIFIED";
6669
}
6770

6871
export class CliError extends Error {

0 commit comments

Comments
 (0)