Skip to content

Global exception handling with @ControllerAdvice and standard error contract #40

@sugan0tech

Description

@sugan0tech
  • Description: Centralize error handling and return a consistent error payload.
  • Current state: Controllers build ad-hoc Map responses; no @ControllerAdvice present.
  • Tasks:
    • Add spring-boot-starter-validation if needed for error binding; create GlobalExceptionHandler with handlers for MethodArgumentNotValidException, AccessDeniedException, EntityNotFoundException, and fallback.
    • Define standard error JSON: {timestamp, status, error, message, path, traceId}.
    • Replace manual map returns as appropriate.
  • Acceptance criteria:
    • Errors across endpoints follow the contract; tests assert shape.
  • References: Controllers under features/*.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions