Context
GlobalExceptionHandler is a @RestControllerAdvice that catches all typed domain exceptions, Spring validation exceptions, and unexpected exceptions, and maps them to RFC 7807 Problem Details responses (Content-Type: application/problem+json). Every response includes a correlationId from the MDC context.
Acceptance criteria
References
Epic E-01 Ledger Foundation. Wiki: Code-Rules, API-Ledger, Architecture-Security.
Definition of Done
Tests green; ktlint and detekt clean; coverage target met; reviewed; SPDX header on new files; no maritime or real-provider names.
Context
GlobalExceptionHandleris a@RestControllerAdvicethat catches all typed domain exceptions, Spring validation exceptions, and unexpected exceptions, and maps them to RFC 7807 Problem Details responses (Content-Type: application/problem+json). Every response includes acorrelationIdfrom the MDC context.Acceptance criteria
MethodArgumentNotValidExceptionmaps to 400 with anerrors[]array containingfieldandcodeper failing constraint.NotFoundException,ConflictException,InvariantException) map to 404, 409, 422 respectively.OptimisticLockExceptionafter retries exhausted maps to 503.correlationIdmatching theX-Correlation-Idresponse header.References
Epic E-01 Ledger Foundation. Wiki: Code-Rules, API-Ledger, Architecture-Security.
Definition of Done
Tests green; ktlint and detekt clean; coverage target met; reviewed; SPDX header on new files; no maritime or real-provider names.