fix(cli): add readable HTTP error messages for 4xx/5xx API failures#3094
Open
jorgemoya wants to merge 1 commit into
Open
fix(cli): add readable HTTP error messages for 4xx/5xx API failures#3094jorgemoya wants to merge 1 commit into
jorgemoya wants to merge 1 commit into
Conversation
Most CLI API calls threw a raw `... failed: ${status} ${statusText}`, giving
users no idea what went wrong or what to do. Add a shared HTTP-error helper
that turns a non-OK Response into a readable error: prefer the API's own
structured error body (title/detail), falling back to a status-class message.
4xx failures throw a UserActionableError (dropping the "share your Correlation
ID with support" framing); 5xx keep it as transient/server-side. Migrate the
raw throws across the channels, project, observability, localization, deploy,
logs, and auth paths. Existing UnauthorizedError (401) and deployment-code
handling are left intact.
Refs LTRAC-977
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: bd1fdc9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
Bundle Size ReportComparing against baseline from No bundle size changes detected. |
Contributor
Unlighthouse Performance Comparison — VercelComparing PR preview deployment Unlighthouse scores vs production Unlighthouse scores. Summary ScoreAggregate score across all categories as reported by Unlighthouse.
Category Scores
Core Web Vitals
|
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.
Linear: LTRAC-977
What/Why?
Most CLI API calls threw a raw
... failed: ${status} ${statusText}, so a user hitting a 400/500 saw a bare status line with no explanation, blame, or next step. This adds a shared HTTP-error helper that converts a non-OKResponseinto a readable error: it prefers the API's own structured body (title/detail) and falls back to a status-class message. 4xx are thrown asUserActionableError(dropping the "share your Correlation ID with support" framing); 5xx keep that framing as transient/server-side. The raw throws across channels, project, observability, localization, deploy, logs, and auth are migrated to the helper. ExistingUnauthorizedError(401) and deployment-code handling are untouched.This is the umbrella error PR. The child tickets — channel-name validation (LTRAC-1088), project-create 404 guidance (LTRAC-1089), and deploy missing-env error (LTRAC-1090) — are separate PRs and touch some of the same files, so expect minor merge-order conflicts.
Testing
http-errors.spec.tsplus updatedchannels/auth/observability/logsspecs — 130 tests pass across 6 CLI spec files. Covers API-body passthrough, 4xx fallback copy, 5xx fallback copy, and empty/unparseable body.pnpm --filter @bigcommerce/catalyst typecheckandlintpass. (The fulltestrun includes unrelated makeswiftmergeCore/upgrade.spectests that time out in this environment — pre-existing, not touched here.)Migration
None.