chore(cli): migrate @fern-api/cli-logger to use CliError#14990
Closed
chore(cli): migrate @fern-api/cli-logger to use CliError#14990
Conversation
Made-with: Cursor
Made-with: Cursor
…actory Made-with: Cursor
…entry routing Introduce CliError with 12-code union (INTERNAL_ERROR, PARSE_ERROR, CONFIG_ERROR, etc.) in @fern-api/task-context. Add captureException to TaskContext interface. Wire Sentry reporting into failWithoutThrowing at point of failure. Update top-level handlers in both CLI v1 and v2 to classify untyped errors as INTERNAL_ERROR. Made-with: Cursor
…xt CliError Delete the local cli-v2 CliError class and switch all 31 importing files to use the shared CliError from @fern-api/task-context. Remap v2 codes (AUTH_REQUIRED→AUTH_ERROR, EXIT→TaskAbortSignal, etc.), replace ~35 CliError.exit() calls with TaskAbortSignal, and classify ~62 untyped new CliError sites with appropriate error codes. Made-with: Cursor
Made-with: Cursor
…ingUnavailableError extend CliError Each subclass now carries a default error code (VALIDATION_ERROR / AUTH_ERROR), eliminating the need for the separate extractErrorCode and local shouldReportToSentry functions in withContext.ts. reportError now relies entirely on resolveErrorCode and the shared shouldReportToSentry from @fern-api/task-context. Made-with: Cursor
Adds the error code as an `error.code` tag to Sentry exceptions, matching the v1 SentryClient behavior. The code is resolved via resolveErrorCode in both reportError and TaskContextAdapter. Made-with: Cursor
Replace all LoggableFernCliError throw sites with CliError.internalError() and remove the dedicated catch branches since CliError is already handled upstream. Deletes the now-unused LoggableFernCliError class. Made-with: Cursor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Description
Migrates
@fern-api/cli-loggerto use the sharedCliErrorinfrastructure introduced in the foundational error classification system (#14749). This PR also includes the complete CliError foundation (sharedCliErrorclass with typed codes,TaskAbortSignalrename, Sentry routing, and CLI v1/v2 integration) that all subsequent per-package migration PRs build on.This is one of the package migration PRs that follow the error classification system introduced in #14749.
Changes Made
Assigned typed error codes and migrated error handling across 86 files spanning the CliError foundation and the
@fern-api/cli-loggerpackage-specific migration.Error codes used
CONFIG_ERRORAUTH_ERRORNETWORK_ERRORVALIDATION_ERRORPARSE_ERRORVERSION_ERRORENVIRONMENT_ERRORINTERNAL_ERRORRESOLUTION_ERRORCONTAINER_ERRORIR_CONVERSION_ERRORFiles touched (grouped by area)
task-context/src/CliError.ts,TaskAbortSignal.ts,TaskContext.ts,MockTaskContext.ts,index.tscli-context/CliContext.ts,TaskContextImpl.ts,cli.ts,cliV2.ts,SentryClient.tscontext/Context.ts,withContext.ts,TaskContextAdapter.ts,TelemetryClient.ts, all command filescli-logger/src/logErrorMessage.ts— migratedFernCliErrortoTaskAbortSignal, added Node 18+ detectionTaskContextImpl.ts,TaskContextFactory.ts,logErrorMessage.tslogin/,snippets/core/,ir-generator/,local-workspace-runner/,remote-workspace-runner/,configuration-loader/,lazy-fern-workspace/Testing
pnpm test, excluding e2e and pre-existing environment failures)