Skip to content

Error responses are inconsistent between REST, validation, and exception filters #1298

Description

@nanaf6203-bit

Context

ResponseFormatInterceptor standardizes success payloads; ValidationExceptionFilter/PrismaExceptionFilter/AllExceptionsFilter emit { statusCode, message, ... } shapes with overlapping fields; DTOs throw BadRequestException at various shapes too.

Problem

Clients observe inconsistent error envelopes per module (array vs string message, presence of path/timestamp), making API SDKs fragile; docs API_VERSIONING doesn't specify the error contract.

Proposed approach

Define a single ErrorResponse contract (code, message, details, traceId - trace interceptor already sets x-trace-id), align the three filters + ValidationPipe exceptionFactory, and add an e2e that snapshots error shapes across representative routes.

Acceptance criteria

  • All error responses share the documented envelope; snapshot test enforces it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions