UNPKG

file-routing-expressjs

Version:

A dependency-free, flexible, system-based file routing for Express.

69 lines 2.35 kB
"use strict"; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var exceptions_exports = {}; __export(exceptions_exports, { InvalidPluginError: () => InvalidPluginError, InvalidRouteHandler: () => InvalidRouteHandler, RoutesRootNotFound: () => RoutesRootNotFound, TimeoutError: () => TimeoutError, UnknownPluginError: () => UnknownPluginError }); module.exports = __toCommonJS(exceptions_exports); class RoutesRootNotFound extends Error { constructor(root) { super(`Routes root not found: ${root}`); this.name = "RoutesRootNotFound"; } } class InvalidRouteHandler extends Error { constructor(method, file) { super(`Invalid handler for method "${method}" in "${file}". Expected a function.`); this.name = "InvalidRouteHandler"; } } class UnknownPluginError extends Error { constructor(pluginName, route, available) { super( `Unknown plugin "${pluginName}" in route "${route}"` + (available.length ? `Available plugins: ${available.join(", ")}.` : `No plugins are registered.`) ); this.name = "UnknownPluginError"; } } class InvalidPluginError extends Error { constructor(message) { super(`[plugin] ${message}`); this.name = "InvalidPluginError"; } } class TimeoutError extends Error { constructor(ms, message = "Request timed out") { super(message); this.name = "TimeoutPluginError"; this.ms = ms; } } // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { InvalidPluginError, InvalidRouteHandler, RoutesRootNotFound, TimeoutError, UnknownPluginError }); //# sourceMappingURL=exceptions.js.map