Skip to content

Feat/sdk error taxonomy#427

Open
aliyuHabibu wants to merge 3 commits into
gear5labs:masterfrom
aliyuHabibu:feat/sdk-error-taxonomy
Open

Feat/sdk error taxonomy#427
aliyuHabibu wants to merge 3 commits into
gear5labs:masterfrom
aliyuHabibu:feat/sdk-error-taxonomy

Conversation

@aliyuHabibu
Copy link
Copy Markdown
Contributor

Feat/sdk error taxonomy
Ready for review.

Closes #377

=== Core error taxonomy (packages/sdk/src/errors.ts) ===
New ErrorCategory enum with 7 top-level categories:
  TRANSPORT, VALIDATION, SIMULATION, POLICY, COMPATIBILITY, EXECUTION, UNKNOWN

SdkError base class with category, code, message, recoverable, details,
cause, and toJSON(). Factory functions for every category:
  transportError, connectionTimeoutError, networkError,
  validationError, invalidInputError, missingFieldError,
  simulationError,
  policyError, rateLimitError, unauthorizedError,
  compatibilityError, unsupportedChainError, unsupportedOperationError,
  executionError, signingError, insufficientFundsError

=== SDK alignment ===
- AgentRequestError extends SdkError with automatic category from HTTP status
- AgentClient: categorized error parsing from API responses, CategorizedError type
- SignatureProviderError: each error code maps to an ErrorCategory
- types/index.ts: new CategorizedError interface for API error responses
- index.ts: exports new errors module

=== Backend alignment ===
- ToolResult: new errorCategory and errorCode fields
- BaseTool.createErrorResult: accepts optional errorCategory and errorCode
- ApplicationError: gains errorCategory (auto-derived from statusCode) and
  errorCode, plus toCategorizedErrorResponse() helper
- ErrorHandler middleware: response includes category and recoverable fields
- SorobanError: maps every SorobanErrorCode to an ErrorCategory via
  sorobanCodeToCategory() and getSorobanCategory() helpers

Clients can now switch on error.category without parsing strings:
  if (err.category === 'POLICY') handleRateLimit()
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Jun 1, 2026

@aliyuHabibu 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

@aliyuHabibu
Copy link
Copy Markdown
Contributor Author

@ALL Can you please approve my points, wave ends in hours

@aliyuHabibu
Copy link
Copy Markdown
Contributor Author

@ALL Can you please approve my points, wave ends in few hours

1 similar comment
@aliyuHabibu
Copy link
Copy Markdown
Contributor Author

@ALL Can you please approve my points, wave ends in few hours

@aliyuHabibu
Copy link
Copy Markdown
Contributor Author

@ALL Conflict resolved, Please approve my points

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.

[Backend] Standardize SDK error taxonomy to match backend execution and policy failures

1 participant