UNPKG

file-routing-expressjs

Version:

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

41 lines 1.13 kB
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; } } export { InvalidPluginError, InvalidRouteHandler, RoutesRootNotFound, TimeoutError, UnknownPluginError }; //# sourceMappingURL=exceptions.mjs.map