Skip to content

Releases: tiny-blocks/http-error-handler

Release list

v1.0.0

Choose a tag to compare

@gustavofreze gustavofreze released this 01 Jul 13:53
fae23d9
  • Map exceptions thrown by downstream handlers to structured JSON error responses (machine-readable code, HTTP status 400-599, message, optional headers) as a PSR-15 middleware.
  • Declare exception-to-error rules through a fluent, first-match-wins ExceptionMappingTable, matching by exact class, any of a list, or subclass, and resolving to a fixed MappedError or one built from the matched throwable by a closure.
  • Log errors through an optional PSR-3 logger with configurable verbosity (ErrorHandlingSettings), enriched with the request correlation id via tiny-blocks/http-correlation-id.
  • Handle unmapped exceptions with a configurable generic 500 fallback or a rethrow to an outer error boundary.