fix: human-readable Stellar error decoder with telemetry (closes #10) - #23
Merged
JamesEjembi merged 2 commits intoJun 16, 2026
Merged
Conversation
…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
Contributor
Author
|
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.ts—resolveError()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 codessrc/utils/errorTelemetry.ts—reportUnknownStellarError()that POSTs unknown codes to the telemetry endpoint (fire-and-forget, safe in SSR)src/hooks/useSorobanBilling.ts— React hook exposingdecodeBillingError/billingErrorstatesrc/hooks/useLedgerEvents.ts— React hook exposingdecodeLedgerEventError/eventErrorstatesrc/components/shared/ErrorToast.tsx— accessible client component with severity colour-coding and expandable troubleshooting sectionapp/api/telemetry/stellar-errors/route.ts— Next.js route handler that receives unknown-code reportsBug fixed
getErrorMessage()inerrorDecoder.tsreturnsstring | null | undefined, butUnknownErrorTelemetryPayload.messageis typed asstring | null. Added?? nullto coerce the value and resolve the TypeScript compile error.Testing
npm run buildnow compiles and type-checks cleanly.Closes #10