Problem Statement. Error codes (e.g. INVALID_TOKEN, INTERNAL_SERVER_ERROR,
AI_SERVICE_ERROR, HTTP_500) are scattered: each handler constructs its own ad-hoc
envelope. error-handling.e2e-spec.ts shows the code field is number for backend
errors but string for AI service errors.
Why it matters. ADR-env consumers want a stable code mapping; an SDK round-trip
through AI service then backend fails without a normalized taxonomy.
Technical Context. src/common/filters/http-exception.filter.ts,
app/ai-service/schemas/errors.py.
Expected Outcome. A shared src/common/errors/codes.ts with ErrorCode = enum
membership, each code carrying human-readable description and HTTP status. Both repos
generate code from docs/errors.yaml.
Acceptance Criteria.
- New module emits codes that are identical between backend and AI service.
- Tests in both repos assert the same
code for the same error class.
Files or modules likely to be affected.
new src/common/errors/codes.ts,
app/ai-service/schemas/errors.py.
Difficulty. Medium
Estimated effort. M
Backlog item #41 from `docs/maintainer-issue-backlog.md.
Problem Statement. Error codes (e.g.
INVALID_TOKEN,INTERNAL_SERVER_ERROR,AI_SERVICE_ERROR,HTTP_500) are scattered: each handler constructs its own ad-hocenvelope.
error-handling.e2e-spec.tsshows thecodefield isnumberfor backenderrors but
stringfor AI service errors.Why it matters. ADR-env consumers want a stable code mapping; an SDK round-trip
through AI service then backend fails without a normalized taxonomy.
Technical Context.
src/common/filters/http-exception.filter.ts,app/ai-service/schemas/errors.py.Expected Outcome. A shared
src/common/errors/codes.tswithErrorCode = enummembership, each code carrying human-readable description and HTTP status. Both repos
generate code from
docs/errors.yaml.Acceptance Criteria.
codefor the same error class.Files or modules likely to be affected.
new
src/common/errors/codes.ts,app/ai-service/schemas/errors.py.Difficulty. Medium
Estimated effort. M
Backlog item #41 from `docs/maintainer-issue-backlog.md.