Skip to content

Stringify Exolix swap error response for readable logs#460

Open
j0ntz wants to merge 1 commit into
masterfrom
jon/stringify-exolix-error
Open

Stringify Exolix swap error response for readable logs#460
j0ntz wants to merge 1 commit into
masterfrom
jon/stringify-exolix-error

Conversation

@j0ntz

@j0ntz j0ntz commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

CHANGELOG

Does this branch warrant an entry to the CHANGELOG?

  • Yes
  • No

Dependencies

none

Description

Exolix's swap-quote error handler logged the raw API error response via String(resJson). Because resJson is a plain object (await response.json()), String() coerced it to the literal [object Object], hiding the actual reason a swap failed (e.g. ARRR→ETH) from the logs.

Switch the interpolation to JSON.stringify(resJson) so the underlying Exolix error payload is human-readable in logs. This line only fires on a 422 response that is not a recognized min-amount error, which is exactly the case where seeing the real payload matters; the thrown SwapCurrencyError is unchanged, so there is no behavioral change beyond log readability.

Before: Error retrieving Exolix quote: [object Object]
After: Error retrieving Exolix quote: {"error":"Currency pair not available","code":"PAIR_UNAVAILABLE",...}

Asana: https://app.asana.com/0/1215088146871429/1212885691958616


Note

Low Risk
Observability-only change on a warn log line; no swap logic, error types, or API handling changed.

Overview
Exolix quote failures on HTTP 422 (when the body is not a recognized min-amount shape) now log the full API JSON via JSON.stringify(resJson) instead of String(resJson), which previously produced useless [object Object] messages.

Swap behavior is unchanged: the same path still throws SwapCurrencyError. The Unreleased CHANGELOG documents this logging fix.

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

Exolix's quote error handler logged the raw API error object via
String(resJson), rendering it as the literal [object Object] and hiding
the actual failure reason. Use JSON.stringify so the Exolix error payload
is human-readable in logs.
@j0ntz j0ntz force-pushed the jon/stringify-exolix-error branch from 46c35f7 to 5398fc6 Compare June 13, 2026 00:18
@j0ntz

j0ntz commented Jun 13, 2026

Copy link
Copy Markdown
Contributor Author

📸 Test evidence: in-app Exolix swap-error path (iOS sim)

exolix provider enabled

exolix provider enabled

lld to eth swap rejected

lld to eth swap rejected

Captured by the agent's in-app test run (build-and-test).

@j0ntz

j0ntz commented Jun 13, 2026

Copy link
Copy Markdown
Contributor Author

Verified the patched log path runs in-app on the iOS simulator (edge-funds account, edge-exchange-plugins served live to the edge-core webview via DEBUG_EXCHANGES on :8083).

The original repro (ARRR to ETH) no longer hits the 422 unsupported path: Exolix now returns a real fixed-rate quote for it. The branch in question (HTTP 422 whose body is not a min-amount rate response) is reached by a pair Exolix does not list. Used LLD (Liberland) to ETH.

CDP console capture from the running app, with the patched bundle loaded:

edge-core: exolix gave swap error: SwapCurrencyError: Exolix does not support liberland:null to ethereum:null

That SwapCurrencyError throw is the statement immediately after the patched log.warn(...${JSON.stringify(resJson)}), with no branch between them, so the patched line executed.

Direct Exolix API confirms the object being stringified:

GET /api/v2/rate?coinFrom=LLD&coinFromNetwork=LIBERLAND&coinTo=ETH&coinToNetwork=ETH&amount=10&rateType=fixed
HTTP 422  {"error":"Such exchange pair is not available"}

Rendering for that body:

  • Before: String({...}) = [object Object]
  • After: JSON.stringify({...}) = {"error":"Such exchange pair is not available"}

No bug surfaced; no code change beyond the committed fix. Also rebased onto master to clear the CHANGELOG conflict.

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