Skip to main content
Module

x/cav/mod.ts>ErrorArg

A server framework for Deno
Go to Latest
interface ErrorArg
import { type ErrorArg } from "https://deno.land/x/cav@0.2.3/mod.ts";

Arguments available to a ResolveError function.

Properties

req: Request

The Request being processed.

headers: Headers

Headers that'll be appended to the returned response after processing has finished.

url: URL

new URL(req.url)

conn: http.ConnInfo

Connection information provided by Deno.

path: string

The routed path.

The unprocessed query object associated with this request.

The unprocoessed path parameters object captured during routing.

error: unknown

The offending error.

res: packResponse

Packs a given body into a Response before resolving, which can be useful in cases where the deserialized value doesn't match the body type because of explicit content-type headers. Be sure to declare the headers init option as const.

bundle: (opt: ServeBundleOptions) => Promise<Response>

Returns a TypeScript/JavaScript bundle as a response. The bundle is cached into memory and, if possible, watched and rebundled whenever updated.

asset: (opt?: ServeAssetOptions) => Promise<Response>

Returns a Response created using an asset from an assets directory.

redirect: (to: string, status?: number) => Response

Returns a redirect Response. If the redirect path doesn't specify an origin, the origin of the current request is used. If the path starts with a ".", it is joined with the pathname of the Request url to get the final redirect path. The default status is 302.