Custom Error Pages

Optionally, you can customize error messages.

Custom Error Handler

import cheetah from 'https://deno.land/x/cheetah/mod.ts'

const app = new cheetah({
  error(error, request) {
    if (error instanceof Error)
      return new Response(error.message)

    return new Response('Unknown Error')
  }
})

Custom Not Found Handler

import cheetah from 'https://deno.land/x/cheetah/mod.ts'

const app = new cheetah({
  notFound(request) {
    return new Response('Not Found')
  }
})