Skip to content

fix: human-readable Stellar error decoder with telemetry (closes #10) - #23

Merged
JamesEjembi merged 2 commits into
Lumina-etwork:mainfrom
ZuLu0890:fix/stellar-error-decoder-issue-10
Jun 16, 2026
Merged

fix: human-readable Stellar error decoder with telemetry (closes #10)#23
JamesEjembi merged 2 commits into
Lumina-etwork:mainfrom
ZuLu0890:fix/stellar-error-decoder-issue-10

Conversation

@ZuLu0890

Copy link
Copy Markdown
Contributor

Summary

Implements the full Stellar/Soroban error decoder required by issue #10, and fixes the TypeScript build error that was blocking compilation.

What was added

  • src/data/errorCodes.json — comprehensive dictionary mapping every Stellar transaction/operation/Soroban error code to a human-readable message, troubleshooting steps, and documentation URL (ICU-style {placeholder} interpolation)
  • src/utils/errorDecoder.tsresolveError() function that extracts the error code from any raw Stellar SDK error shape, looks it up in the dictionary, interpolates context values, and falls through to a generic message for unmapped codes
  • src/utils/errorTelemetry.tsreportUnknownStellarError() that POSTs unknown codes to the telemetry endpoint (fire-and-forget, safe in SSR)
  • src/hooks/useSorobanBilling.ts — React hook exposing decodeBillingError / billingError state
  • src/hooks/useLedgerEvents.ts — React hook exposing decodeLedgerEventError / eventError state
  • src/components/shared/ErrorToast.tsx — accessible client component with severity colour-coding and expandable troubleshooting section
  • app/api/telemetry/stellar-errors/route.ts — Next.js route handler that receives unknown-code reports

Bug fixed

getErrorMessage() in errorDecoder.ts returns string | null | undefined, but UnknownErrorTelemetryPayload.message is typed as string | null. Added ?? null to coerce the value and resolve the TypeScript compile error.

Testing

npm run build now compiles and type-checks cleanly.

Closes #10

name.ZuLu0890 and others added 2 commits June 16, 2026 11:41
…Error type

getErrorMessage() returns string | null | undefined but
UnknownErrorTelemetryPayload.message is typed as string | null.
Using ?? null normalizes the value and resolves the TS build error.

Closes Lumina-etwork#10
@ZuLu0890

Copy link
Copy Markdown
Contributor Author

done

@JamesEjembi
JamesEjembi merged commit beb7be2 into Lumina-etwork:main Jun 16, 2026
1 check passed
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.

Human-Readable Dictionary Mapping Cryptic Stellar Node Exceptions

2 participants