Skip to content

Feature: Standardize API error response format #69

@Smartdevs17

Description

@Smartdevs17

Problem

Error responses are inconsistent across endpoints. Some return { success: false, error: string }, others return different formats from the error handler middleware.

Context

API consumers must handle multiple response formats, increasing client complexity.

Proposed Solution

Define a standard error response:

interface ErrorResponse {
  success: false;
  error: {
    code: string;
    message: string;
    details?: unknown;
  };
  requestId?: string;
}

Acceptance Criteria

  • All error responses follow the same schema
  • Error codes defined and documented
  • Error handler middleware produces standard format
  • Tests verify error response structure

Technical Notes

  • Files: api/src/middleware/errorHandler.ts, api/src/types/index.ts

Constraints

  • Backward compatible (keep success field)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stellar WaveIssues in the Stellar wave programapiREST API componenteasyDifficulty: EasyenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions