Middy Middleware
Axis ships Middy middleware so every handler gets consistent error handling and logging without repeating boilerplate. Wrap your handler and the middleware does the rest.
The middleware
Section titled “The middleware”- Error-handler middleware — catches thrown errors, maps
AtfErrorsubclasses to the right HTTP status viastatusCodeFor, and returns a clean response without leaking a stack trace. - Logging middleware — wires the masked logger into the request lifecycle so every invocation gets structured, secret-scrubbed logs.
Typed errors flow through
Section titled “Typed errors flow through”Throw a NotFoundError, ValidationError, ForbiddenError, ConflictError, or QuotaExceededError from service code and the error-handler middleware turns it into the correct status (404/400/403/409/429). This is why service code should throw typed errors rather than assembling HTTP responses by hand.
Where to go next
Section titled “Where to go next”- Masked Logger for the logging half.
- The generated API reference for the middleware signatures and the error classes.
© 2026 Axis Tech. Powered by axis-tech.co.