Skip to content

feat(sdk): surface typed contract error taxonomy end-to-end (#404) - #466

Open
Anadudev wants to merge 2 commits into
ToluLabs:mainfrom
Anadudev:typed-error-taxonomy-404
Open

feat(sdk): surface typed contract error taxonomy end-to-end (#404)#466
Anadudev wants to merge 2 commits into
ToluLabs:mainfrom
Anadudev:typed-error-taxonomy-404

Conversation

@Anadudev

Copy link
Copy Markdown

Closes #404

Summary of Changes

  • Typed ContractError Class: Converted ContractError into a typed, instanceof-checkable Error class carrying code: number | null, friendly: string, and raw: string.
  • SDK Error Taxonomy Integration: Exported ContractError, the canonical PROOF_REGISTRY_ERRORS code-to-message lookup table, and isRetryableContractError directly from @stellarcred/sdk and attached them to the StellarCred namespace export.
  • Contract Submit Flow Alignment: Updated sendAndConfirm and submitProofs in frontend/lib/contracts.ts to directly parse and throw ContractError instances upon contract execution/simulation failure rather than plain generic Error instances.
  • UI Branching & Retry Logic: Updated frontend/app/holder/page.tsx proof submission catch handlers to branch on e instanceof ContractError and use isRetryableContractError(error) to determine whether retry actions are shown or if a terminal failure state should be displayed.
  • Test Coverage: Added comprehensive tests in frontend/lib/__tests__/contracts.test.ts and frontend/packages/sdk/src/index.test.ts verifying typed error mapping, instanceof compatibility, namespace exports, and retryability branching.

Acceptance Criteria Verified

  • Contract panics surface as typed SDK ContractError instances with error codes and friendly messages.
  • UI branches programmatically on ContractError and evaluates retryable vs terminal states (isRetryableContractError).
  • PROOF_REGISTRY_ERRORS serves as the single source of truth across the stack.

@drips-wave

drips-wave Bot commented Aug 31, 2026

Copy link
Copy Markdown

@Anadudev Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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.

Improvement: typed error taxonomy surfaced end-to-end from contract panic to SDK to UI

1 participant