Skip to content

zero-auth API Documentation v1.6.0


zero-auth API Documentation / authErrorHandler

Variable: authErrorHandler ​

const authErrorHandler: ErrorRequestHandler

Defined in: packages/zero-auth/src/errors/errorHandler.ts:17

Express error-handling middleware for AuthError instances.

Mount this after all routes to ensure auth errors are caught and returned as structured JSON responses.

Example ​

ts
app.use(authErrorHandler);
// or use the shorthand:
app.use(auth.errorHandler);