Skip to content

Add typed error taxonomy in errorCodes.ts with public/internal split and i18n message keys #355

@thlpkee20-wq

Description

@thlpkee20-wq

Description

The current errorCodes.ts is ad hoc. Replace it with a typed taxonomy distinguishing public-facing error codes (stable contract) from internal-only ones, and route messages through i18n keys instead of literals.

Requirements and context

  • Must be secure, tested, and documented
  • Should be efficient and easy to review
  • Relevant code: src/errors/errorCodes.ts, src/errors/sendError.ts
  • Public codes guaranteed to be stable across versions

Suggested execution

  • Fork the repo and create a branch
  • git checkout -b refactor/error-taxonomy
  • Implement changes
    • Discriminated union of public/internal errors
    • Codegen of doc table from taxonomy
    • Type-safe sendError accepting only known codes
  • Validate security and correctness assumptions

Test and commit

  • Run tests
    • npm test
  • Cover edge cases
    • Unknown code at compile-time is a type error
  • Include test output and notes

Example commit message

refactor: typed error taxonomy with i18n keys

Guidelines

  • Minimum 95 percent test coverage
  • Clear documentation
  • Timeframe: 96 hours

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programbackendBackend scopedocumentationDocumentation updates requiredrefactorRefactors with no behavior change

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions