Skip to main content
Module

x/deno_koa/context.ts>Context#throw

A middleware framework for Deno's http serve🦕. Transplanted from Koa with ❤️
Latest
method Context.prototype.throw
import { Context } from "https://deno.land/x/deno_koa@v1.0.4/context.ts";

Throw an error with msg and optional status defaulting to 500. Note that these are user-level errors, and the message may be exposed to the client.

this.throw(403) this.throw(400, 'name required') this.throw('something exploded') this.throw(new Error('invalid')) this.throw(400, new Error('invalid'))

Note: status should only be passed as the first parameter.

Parameters

...args: any[]

msg or status

Returns

never