Skip to content

fix(api): Throw ApiError instead of raw Response objects - #2550

Open
sentry[bot] wants to merge 1 commit into
masterfrom
seer/fix/api-error-reporting
Open

sentry[bot] wants to merge 1 commit into
masterfrom
seer/fix/api-error-reporting

Conversation

@sentry

@sentry sentry Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

This PR addresses Sentry issues like SOLID-G6 (?anon_0_) where API call failures were reported as generic "Object captured as exception".

Problem: In lib/api.ts, many API functions (including refreshToken) used if (!response.ok) throw response; when a fetch request returned a non-OK status. This meant a raw Response object was thrown, which Sentry could not parse into a meaningful error message or stack trace.

Solution: All occurrences of throw response in lib/api.ts have been replaced with throw await toApiError(response, 'Request failed');. This ensures that a proper ApiError instance is always thrown on API failures. The toApiError helper extracts relevant information (like status and backend error messages) from the Response object, providing much richer context for Sentry reports.

Impact: Sentry will now capture detailed ApiError exceptions for API failures, significantly improving debuggability and reducing the occurrence of cryptic ?anon_0_ issues.

Fixes SOLID-G6

@sentry <feedback>: Autofix iterates on these changes
@sentry stop iterating: Autofix stops iterating on this run

This PR was automatically generated by Sentry. You can adjust this setting at any time.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

@vercel

vercel Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

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

2 Skipped Deployments
Project Deployment Actions Updated
solid-app Ignored Ignored Preview Sep 22, 2026 10:36am UTC
solid-app-staging Ignored Ignored Preview Sep 22, 2026 10:36am UTC

Request Review

This branch has not been deployed

No deployments
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.

0 participants