Skip to main content
Module

x/http_error/mod.ts>HttpError

An error class for HTTP requests.
Go to Latest
class HttpError
extends Error
import { HttpError } from "https://deno.land/x/http_error@0.1.3/mod.ts";

An error for an HTTP request.

Constructors

new
HttpError(
status?: number,
message?: string,
options?: HttpErrorOptions,
)
new
HttpError(status?: number, options?: HttpErrorOptions)
new
HttpError(message?: string, options?: HttpErrorOptions)
new
HttpError(options?: HttpErrorOptions)
new
HttpError(
statusOrMessageOrOptions?: number | string | HttpErrorOptions,
messageOrOptions?: string | HttpErrorOptions,
options?: HttpErrorOptions,
)

Properties

expose: boolean

Determines if the error should be exposed in the response. Defaults to true for client error statuses and false for server error statuses.

status: number

The HTTP status associated with the error. Must be a client or server error status. Defaults to 500.