Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/keywork/errors/mod.ts

A library for building V8 Isolate web apps on Cloudflare Workers, Deno, and Node.JS
Latest
import * as keywork from "https://deno.land/x/keywork@v6.2.1/errors/mod.ts";

Keywork includes error utilities that pair nicely with HTTP request handlers.

import { KeyworkResourceError, StatusCodes } from 'keywork/errors'

if (isLoggedIn(someUser)) {
  throw new KeyworkResourceError('You must be logged in to do that', StatusCodes.UNAUTHORIZED)
}

if (someUser.role !== 'admin') {
  throw new KeyworkResourceError('Only an admin can access that', StatusCodes.FORBIDDEN)
}

Related Entries

  • Keywork#HTTP#Response.ErrorResponse | ErrorResponse

Classes

An error class that feels fits nicely into an incoming HTTP request handler.

Enums

Standard HTTP status codes.

Variables

Used in place of the reference-sensitive instanceof

A record of all the status codes text.

Interfaces

A JSON representation of a KeyworkResourceError