Skip to content
Merged
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
1 change: 1 addition & 0 deletions packages/cli/cli/src/cli-context/TaskContextImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
TaskContext,
TaskResult
} from "@fern-api/task-context";

import chalk from "chalk";

import { reportError } from "../telemetry/reportError.js";
Expand Down
11 changes: 7 additions & 4 deletions packages/cli/task-context/src/CliError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ export namespace CliError {
ValidationError: "VALIDATION_ERROR",
NetworkError: "NETWORK_ERROR",
AuthError: "AUTH_ERROR",
ConfigError: "CONFIG_ERROR"
ConfigError: "CONFIG_ERROR",
Unclassified: "UNCLASSIFIED"
} as const;
}

Expand All @@ -73,7 +74,8 @@ const SENTRY_REPORTABLE: Record<CliError.Code, boolean> = {
[CliError.Code.ValidationError]: false,
[CliError.Code.NetworkError]: false,
[CliError.Code.AuthError]: false,
[CliError.Code.ConfigError]: false
[CliError.Code.ConfigError]: false,
[CliError.Code.Unclassified]: false
};

export function shouldReportToSentry(code: CliError.Code): boolean {
Expand All @@ -93,7 +95,8 @@ function isNodeVersionError(error: unknown): boolean {
/**
* Resolves the effective error code: explicit override wins,
* then auto-detects from known error types,
* and falls back to INTERNAL_ERROR for truly unknown errors.
* and falls back to UNCLASSIFIED for unknown errors until all packages
* are migrated to the new error system.
*/
export function resolveErrorCode(error: unknown, explicitCode?: CliError.Code): CliError.Code {
if (explicitCode != null) {
Expand All @@ -108,5 +111,5 @@ export function resolveErrorCode(error: unknown, explicitCode?: CliError.Code):
if (isNodeVersionError(error)) {
return CliError.Code.EnvironmentError;
}
return CliError.Code.InternalError;
return CliError.Code.Unclassified;
}
Loading