Skip to content

chore: getErrorData util for Sentinel API - #10642

Merged
micaelae merged 6 commits into
mainfrom
swaps5091-get-error-data
Sep 30, 2026
Merged

micaelae merged 6 commits into
mainfrom
swaps5091-get-error-data

Conversation

@micaelae

@micaelae micaelae commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

Explanation

Export getErrorData util which extracts data from Sentinel API errors

References

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

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
Additive public utility and tests only; no change to fetch or controller success paths.

Overview
Adds and exports a public getErrorData helper so consumers can turn Sentinel/smart-transaction failures into user-facing or analytics strings without reimplementing fetch error parsing.

When handleFetch rejects, it attaches camel-cased JSON on a thrown object’s data field (not a true Error instance). getErrorData returns data.error when it’s a string, otherwise JSON-stringifies data, and falls back to Error.message or String(error) for ordinary errors.

Coverage includes unit tests for those branches and a getFees integration test asserting a 400 Sentinel response still rejects with message: 'Fetch error: 400' and structured data.error. The package changelog documents the new export.

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

@micaelae
micaelae requested review from a team as code owners September 30, 2026 22:16
@micaelae
micaelae deployed to default-branch September 30, 2026 22:16 — with GitHub Actions Active
@micaelae
micaelae force-pushed the swaps5091-get-error-data branch from 529e64a to bbc4d51 Compare September 30, 2026 22:19

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit bbc4d51. Configure here.

Comment thread packages/smart-transactions-controller/src/utils.ts Outdated
Comment thread packages/smart-transactions-controller/src/SmartTransactionsController.test.ts Outdated
@micaelae
micaelae enabled auto-merge September 30, 2026 23:04
@micaelae
micaelae force-pushed the swaps5091-get-error-data branch from d81b093 to 7dbdc23 Compare September 30, 2026 23:13
@micaelae
micaelae added this pull request to the merge queue Sep 30, 2026
Merged via the queue into main with commit 6426ed7 Sep 30, 2026
43 checks passed
@micaelae
micaelae deleted the swaps5091-get-error-data branch September 30, 2026 23:24
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