Skip to content

fix(cli): add readable HTTP error messages for 4xx/5xx API failures#3094

Open
jorgemoya wants to merge 1 commit into
canaryfrom
jorgemoya/ltrac-977-readable-error-messagesfallbacks-for-400s500s-cli
Open

fix(cli): add readable HTTP error messages for 4xx/5xx API failures#3094
jorgemoya wants to merge 1 commit into
canaryfrom
jorgemoya/ltrac-977-readable-error-messagesfallbacks-for-400s500s-cli

Conversation

@jorgemoya

Copy link
Copy Markdown
Contributor

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-OK Response into a readable error: it prefers the API's own structured body (title/detail) and falls back to a status-class message. 4xx are thrown as UserActionableError (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. Existing UnauthorizedError (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

  • New http-errors.spec.ts plus updated channels/auth/observability/logs specs — 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 typecheck and lint pass. (The full test run includes unrelated makeswift mergeCore/upgrade.spec tests that time out in this environment — pre-existing, not touched here.)

Migration

None.

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-bot

changeset-bot Bot commented Jul 10, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: bd1fdc9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@bigcommerce/catalyst Patch

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

@vercel

vercel Bot commented Jul 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
catalyst Ready Ready Preview, Comment Jul 10, 2026 3:54pm

Request Review

@github-actions

Copy link
Copy Markdown
Contributor

Bundle Size Report

Comparing against baseline from 8d9f9a9 (2026-07-10).

No bundle size changes detected.

@jorgemoya jorgemoya marked this pull request as ready for review July 10, 2026 16:00
@jorgemoya jorgemoya requested a review from a team as a code owner July 10, 2026 16:00
@github-actions

Copy link
Copy Markdown
Contributor

Unlighthouse Performance Comparison — Vercel

Comparing PR preview deployment Unlighthouse scores vs production Unlighthouse scores.

Summary Score

Aggregate score across all categories as reported by Unlighthouse.

Prod Desktop Prod Mobile Preview Desktop Preview Mobile
Score 89 92 92 94

Category Scores

Category Prod Desktop Prod Mobile Preview Desktop Preview Mobile
Performance 76 84 73 89
Accessibility 95 92 95 92
Best Practices 100 100 100 100
SEO 100 100 100 100

Core Web Vitals

Metric Prod Desktop Prod Mobile Preview Desktop Preview Mobile
LCP 3.7 s 4.4 s 5.5 s 3.8 s
CLS 0.001 0 0.037 0
FCP 1.2 s 1.4 s 1.2 s 1.1 s
TBT 0 ms 10 ms 0 ms 20 ms
Max Potential FID 40 ms 60 ms 50 ms 80 ms
Time to Interactive 3.7 s 4.8 s 5.5 s 4.3 s

Full Unlighthouse report →

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant