Skip to main content
Module

x/reno/reno/mod.ts>MissingRouteError

A thin, testable routing library designed to sit on top of Deno's standard HTTP module
Latest
class MissingRouteError
extends Error
import { MissingRouteError } from "https://deno.land/x/reno@v2.0.105/reno/mod.ts";

An error that's thrown by Reno when a route for a particular request's path cannot be found in the router's route map. You won't need to instantiate and throw this directly, but it's exported to support instanceof checks in error handling logic:

const notFound = (e: MissingRouteError) => createErrorResponse(404, e);
const serverError = (e: Error) => createErrorResponse(500, e);

const mapToErrorResponse = (e: Error) =>
  e instanceof MissingRouteError ? notFound(e) : serverError(e);

Constructors

new
MissingRouteError(pathname: string)