Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/Aquaticat/Monochromatic. TypeScript and Rust monorepo: Claude Code and Pi coding-agent plugins, a m
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354/** Error classes the router maps onto HTTP statuses.
Thrown rather than returned so a refusal cannot be silently dropped by a caller that forgets to inspect a result field. The Caddy original this Worker replaces had no refusal path at all: its template functions coerced unparseable input to zero and answered 200, so a caller could receive a value drawn from a range it never asked for.
@module */
//region Errors
/** Input the request supplied that this Worker refuses to guess at.
Maps to 400. Covers a missing or non-canonical `min` or `max`, a repeated query parameter, a `min` above its `max`, a range too wide to draw from uniformly, and a length segment that looks numeric but falls outside the served range. */export class BadRequestError extends Error { /** @param message - explanation naming the offending input and the domain that would have been accepted */ constructor(message: string,) { super(message,); this.name = 'BadRequestError'; }}
/** Path that matches no route and does not look like an attempt at one.
Maps to 404. Deliberately distinct from {@link BadRequestError}: a path such as `/nope` is unknown rather than malformed, while `/65` shows the caller understood the API and asked for too much, so the two deserve different statuses and different remediation text. */export class NotFoundError extends Error { /** @param message - explanation naming the unmatched path and listing the served routes */ constructor(message: string,) { super(message,); this.name = 'NotFoundError'; }}
//endregion Errors