Skip to main content
Deno 2 is finally here 🎉️
Learn more

oak_exception

Deno

A global exception filter middleware by oak.

Example

import { anyExceptionFilter } from "https://deno.land/x/oak_exception@v0.0.6/mod.ts";
import { Application } from "https://deno.land/x/oak@v10.0.0/mod.ts";

const app = new Application();
app.use(anyExceptionFilter());

// other middleware

app.use((ctx) => {
  throw new Error("500");
  ctx.response.body = "Hello World!";
});

console.log("app started with: http://localhost");
await app.listen(":80");