Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/oak_exception/src/exception.ts>anyExceptionFilter

A global exception filter middleware by oak.
Latest
variable anyExceptionFilter
import { anyExceptionFilter } from "https://deno.land/x/oak_exception@v0.2.1/src/exception.ts";

A middleware that will deal the exceptions when called, and set the response time for other middleware in milliseconds as X-Response-Time which can be used for diagnostics and other instrumentation of an application. Utilise the middleware before the "real" processing occurs.

import { anyExceptionFilter } from "https://deno.land/x/oak-middleware/mod.ts";
import { Application } from "https://deno.land/x/oak/mod.ts"

const app = new App();
app.use(anyExceptionFilter({
 logger: console,
 isHeaderResponseTime: true,
}));

// other middleware

await app.listen(":80");

type

(options?: ExceptionOptions) => unknown