Skip to main content

oak_exception

Deno

A global exception filter middleware by oak.

Example

import { anyExceptionFilter } from "https://deno.land/x/oak_exception@v0.0.7/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");