Skip to content

Refactor: Implement Unified Error Code Registry with Developer Documentation #484

Description

@Smartdevs17

Context

API errors return inconsistent formats and non-descriptive messages. Developers struggle to handle errors programmatically.

Current Limitation/Problem

Error codes are ad-hoc strings. The same error type may return different codes from different endpoints. There is no centralized error code registry.

Expected Outcome

A unified error code system with structured error responses, a centralized registry, auto-generated developer documentation, and SDK-friendly error types.

Acceptance Criteria

  • Define error code format: ERR_<CATEGORY>_<SPECIFIC> (e.g., ERR_PAYMENT_INSUFFICIENT_FUNDS)
  • Centralized error code registry with description, HTTP status, and resolution hints
  • Standardized error response: { error: { code, message, details, requestId } }
  • All endpoints return errors in standard format
  • Error code discoverability: GET /api/errors returns full registry
  • SDK generates typed error classes from registry
  • OpenAPI integration: documented error responses per endpoint
  • Error categorization: auth, validation, payment, blockchain, rate_limit, internal
  • Error code deprecation with sunset timeline

Technical Scope

  • packages/error-codes/ - error code registry package
  • backend/src/middleware/error-handler.ts - standardized error response
  • backend/src/errors/ - error classes
  • packages/sdk/src/errors/ - typed error classes
  • Auto-generation of error documentation
  • Edge cases: error wrapping, sensitive information leakage, 3rd-party error mapping

Metadata

Metadata

Assignees

Labels

200-points200 point issueStellar WaveIssues in the Stellar wave programdrips-waveIssues in the Drips Wave programhighHigh complexity issue

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions