/** * vapor-chamber-router - the single error taxonomy. * * Every router failure is the core's `BusError` (src/failure.ts, which keeps * the bus out of the router's graph, docs/contract.md 6), coded `router:condition:subject` * (shape rules 2 and 3) and listed in ERROR_CODE_REGISTRY. Handlers switch on * `code` or read the condition with `conditionOf`, never the message text; the * navigation target is `context.to`, the original error `cause`. Only `failed` * keeps a stack (docs/contract.md 6), as everywhere in the library. * * This is ALSO the navigation result: `navigate()` resolves to * `RouterError | null` - null means committed. Refusals that are normal flow * (`refused:guard`, `aborted:navigation`) are returned to the caller but NOT * dispatched to onError. */ import { BusError } from '../failure'; import type { RouteLocation } from './types'; /** What a raise site passes: `condition:subject`. The owner, `router`, is this module's. */ export type RouterFailCode = 'missing:route' | 'refused:guard' | 'aborted:navigation' | 'missing:routes' | 'missing:record' | 'exceeded:redirects' | 'failed:guard' | 'failed:history' | 'already:route' | 'missing:parent' | 'invalid:parent' | 'missing:param' | 'invalid:menu' | 'invalid:path' | 'unexpected:routes' | 'failed:routes' | 'missing:inline' | 'missing:url' | 'missing:component' | 'failed:component' | 'failed:loader' | 'missing:loader' | 'missing:fetchBlade' | 'missing:http' | 'failed:blade' | 'invalid:component' | 'missing:router'; /** A whole router code, `router:condition:subject`. */ export type RouterErrorCode = `router:${RouterFailCode}`; /** A router failure: the core's BusError, with the navigation target in `context.to`. */ export type RouterError = BusError & { readonly code: RouterErrorCode; readonly context?: { to?: RouteLocation; }; }; export declare function routerError(code: RouterFailCode, message: string, extra?: { to?: RouteLocation; cause?: unknown; }): RouterError; export declare function isRouterError(error: unknown, code?: RouterErrorCode): error is RouterError; /** Codes where the server gets the last word, docs/contract.md 6's rule: a route, * component or server HTML that is missing or failed. The default onError * handler hard-navigates - an unmatched URL renders server-side, a failed * lazy chunk (stale hashes after a deploy) recovers via a full page load. * tests/router/router-codes.test.ts holds it to the rule over the registry. */ export declare const HARD_NAV_CODES: ReadonlySet; //# sourceMappingURL=errors.d.ts.map