Skip to content

Implement comprehensive SDK error hierarchy with error codes and structured error handling#211

Open
Opulencechuks wants to merge 1 commit into
BCPathway:mainfrom
Opulencechuks:error-hierarchy
Open

Implement comprehensive SDK error hierarchy with error codes and structured error handling#211
Opulencechuks wants to merge 1 commit into
BCPathway:mainfrom
Opulencechuks:error-hierarchy

Conversation

@Opulencechuks
Copy link
Copy Markdown

@Opulencechuks Opulencechuks commented Jun 1, 2026

This PR closes #176
Summary
Implemented a comprehensive SDK error hierarchy with standardized error codes, structured error classes, and enhanced error handling throughout the SDK. Added parsing of Soroban panic messages and introduced an isRetryable flag for better recovery strategies.

Type of Change

  • 🐛 Bug fix (non‑breaking change that fixes an issue)
  • ✨ New feature (non‑breaking change that adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to change)
  • 📝 Documentation update
  • 🔧 Smart contract improvement
  • 🧪 Test coverage improvement
  • 🏗️ CI/Build improvement

Related Issue

Closes #176

Changes Made

  • Added sdk/src/errors.ts with BcForgeErrorCode enum, base BcForgeError class, and specific subclasses: NetworkError, SimulationError, TransactionError, ContractError, ValidationError.
  • Implemented panic parsing in SimulationError to extract concise error messages.
  • Updated SDK utilities (sdk/src/utils.ts) to import and use the new error classes.
  • Replaced generic throw new Error statements with structured errors (SimulationError, ValidationError), providing error codes and retry hints.
  • Adjusted error handling in transaction submission and simulation flows to use the new hierarchy.

Testing

How has this been tested?

  • Rust unit tests pass (cargo test)
  • SDK compiles (npm run build in sdk/)
  • Manual testing against Soroban testnet
  • New tests added for changes

Test commands run:

# SDK build
cd sdk && npm run build

Checklist

  • My code follows the project's style guidelines
  • I have added NatSpec-style comments to new Rust functions
  • I have added JSDoc comments to new TypeScript functions
  • I have updated the README if needed
  • My branch follows the naming convention: feature/<issue-number>-<description>
  • I have not modified files outside the scope of this issue

Drips.network Contributor Info

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Jun 1, 2026

@Opulencechuks 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.

Implement comprehensive SDK error hierarchy with error codes

1 participant