Skip to content

chore: expose structured stx fetch error data - #10494

Merged
micaelae merged 4 commits into
mainfrom
swap5090-stx-fetch-error
Sep 29, 2026
Merged

micaelae merged 4 commits into
mainfrom
swap5090-stx-fetch-error

Conversation

@micaelae

@micaelae micaelae commented Sep 25, 2026 •

Copy link
Copy Markdown
Member

Explanation

Problem

The sentinel API returns structured error data for some fetch errors but they get stringified. This requires consumers to parse details from the Error message

Solution

Add the raw JSON data to the Error object so it can be accessed through error.data

References

Fixes https://consensyssoftware.atlassian.net/browse/SWAPS-5090

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Low Risk
Small change to error shape for failed HTTP fetches; consumers that parsed the old message string need to use error.data instead.

Overview
When Sentinel API calls fail with a non-OK HTTP response, handleFetch no longer embeds the full JSON body in the thrown Error message. It now throws Fetch error: {status} and attaches the response body (keys camelCased via mapKeysToCamel) on error.data, so callers can read structured fields without parsing the message string.

Unit tests cover success, network failure, and non-OK responses (including the existing console.log of the response). The package changelog notes this under Unreleased.

Reviewed by Cursor Bugbot for commit f9680b8. Bugbot is set up for automated code reviews on this repo. Configure here.

@micaelae
micaelae requested review from a team as code owners September 25, 2026 19:42
@micaelae
micaelae deployed to default-branch September 25, 2026 19:42 — with GitHub Actions Active
@micaelae
micaelae enabled auto-merge September 25, 2026 19:43
@micaelae
micaelae added this pull request to the merge queue Sep 29, 2026
Merged via the queue into main with commit 19b2ac2 Sep 29, 2026
44 checks passed
@micaelae
micaelae deleted the swap5090-stx-fetch-error branch September 29, 2026 00:15
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.

2 participants