Skip to content

feat: surface HTTP status and headers in CLI error output#313

Merged
felipefreitag merged 4 commits into
mainfrom
feat-surface-http-error-details
May 28, 2026
Merged

feat: surface HTTP status and headers in CLI error output#313
felipefreitag merged 4 commits into
mainfrom
feat-surface-http-error-details

Conversation

@felipefreitag

@felipefreitag felipefreitag commented May 28, 2026

Copy link
Copy Markdown
Contributor

When a request is intercepted by a forward proxy or egress filter returning a non-JSON 4xx (e.g. 403 with a custom X-Deny-Reason header), the SDK preserves statusCode and response headers but the CLI was dropping both, leaving users staring at a "looks like a transient Resend 5xx" message with no way to tell the request never reached Resend. Both JSON and TTY modes now expose the underlying status and a curated set of diagnostic headers (content-type, retry-after, x-*).

Closes #312


Summary by cubic

Expose HTTP status, diagnostic headers, and optional response body in CLI errors to help users tell upstream blocks from transient 5xx. Works in both JSON and TTY modes; satisfies DEV-921.

  • New Features

    • JSON errors include statusCode, filtered headers (content-type, retry-after, x-*), and body when present.
    • TTY adds a hint line with HTTP status and diagnostic headers; headers-only hints render without statusCode.
    • Non-diagnostic headers (e.g., set-cookie, date, server) are dropped.
    • with-retry and spinner propagate statusCode and headers to outputError.
  • Dependencies

    • Bump package version to 2.3.0.

Written for commit 105849d. Summary will update on new commits.

Review in cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 4 files

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread src/lib/output.ts
When a request is intercepted by a forward proxy or egress filter
returning a non-JSON 4xx (e.g. 403 with a custom X-Deny-Reason header),
the SDK preserves statusCode and response headers but the CLI was
dropping both, leaving users staring at a "looks like a transient
Resend 5xx" message with no way to tell the request never reached
Resend. Both JSON and TTY modes now expose the underlying status and a
curated set of diagnostic headers (content-type, retry-after, x-*).

Closes #312
@felipefreitag felipefreitag force-pushed the feat-surface-http-error-details branch from 5e8c101 to a603cdd Compare May 28, 2026 14:22

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 issues found across 1 file (changes from recent commits).

Requires human review: Auto-approval blocked by 1 unresolved issue from previous reviews.

Re-trigger cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 issues found across 2 files (changes from recent commits).

Auto-approved: This change safely enhances error output by surfacing HTTP status, diagnostic headers, and optional body from the SDK, limited to CLI error display with filtered headers and comprehensive tests—no core logic, security, or infrastructure is affected.

Re-trigger cubic

The TTY branch of outputError gated the entire hint line on statusCode
being a number, suppressing headers in the rare case a caller supplies
them without a status. The JSON branch and the ErrorOutput type both
treat the fields as independent; align TTY with that contract so any
combination (status only, headers only, or both) is surfaced.
@felipefreitag felipefreitag force-pushed the feat-surface-http-error-details branch from b940507 to c190173 Compare May 28, 2026 14:41
@felipefreitag felipefreitag merged commit c750272 into main May 28, 2026
18 of 19 checks passed
@felipefreitag felipefreitag deleted the feat-surface-http-error-details branch May 28, 2026 14:59
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.

CLI doesn't surface HTTP status/headers/body that the underlying SDK preserves on non-JSON 4xx responses

2 participants