Skip to content

Unify API error envelopes across route handlers #372

Description

@Abidoyesimze

API routes return inconsistent error JSON shapes.

Affected files

  • src/app/api/**/route.ts
  • src/lib/api-response.ts

Tasks

  • Use api-response helpers for all error paths.
  • Standardize { error: { code, message } } (or documented contract).
  • Update client fetch code to parse the unified shape.

Acceptance criteria

  • Scope is limited to the files listed (or agreed alternatives in the PR).
  • Change is verifiable: tests, screenshots, or written QA steps in the PR.
  • No behavior regressions in related user flows.
  • No new duplicate abstractions without a one-line rationale in the PR.

Suggested labels

cleanup, api, refactor

Notes

Standalone cleanup issue from CLEANUP_ISSUES_2026-05.md. Complements the audit queue and product backlog.

Metadata

Metadata

Type

No type

Fields

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