/**
 * Custom error classes for RSC Router
 *
 * All errors include:
 * - Descriptive names for easy identification
 * - Cause property for structured debugging data
 */
/**
 * Options for error construction
 */
interface ErrorOptions {
    cause?: unknown;
}
/**
 * Thrown when no route matches the requested pathname
 */
export declare class RouteNotFoundError extends Error {
    name: "RouteNotFoundError";
    cause?: unknown;
    constructor(message: string, options?: ErrorOptions);
}
/**
 * Thrown when data is not found (e.g., product with ID doesn't exist)
 * Use this in handlers/loaders to trigger the nearest notFoundBoundary
 *
 * @example
 * ```typescript
 * route("products.detail", async (ctx) => {
 *   const product = await db.products.get(ctx.params.slug);
 *   if (!product) throw new DataNotFoundError("Product not found");
 *   return <ProductDetail product={product} />;
 * });
 * ```
 */
export declare class DataNotFoundError extends Error {
    name: "DataNotFoundError";
    cause?: unknown;
    constructor(message?: string, options?: ErrorOptions);
}
/**
 * Convenience function to throw a DataNotFoundError
 * Shorter syntax for common not-found scenarios
 *
 * @example
 * ```typescript
 * const product = await db.products.get(slug);
 * if (!product) throw notFound("Product not found");
 * // or simply:
 * if (!product) throw notFound();
 * ```
 */
export declare function notFound(message?: string): never;
/**
 * Thrown when middleware execution fails
 */
export declare class MiddlewareError extends Error {
    name: "MiddlewareError";
    cause?: unknown;
    constructor(message: string, options?: ErrorOptions);
}
/**
 * Thrown when a route handler fails
 */
export declare class HandlerError extends Error {
    name: "HandlerError";
    cause?: unknown;
    constructor(message: string, options?: ErrorOptions);
}
/**
 * Thrown when segment building fails
 */
export declare class BuildError extends Error {
    name: "BuildError";
    cause?: unknown;
    constructor(message: string, options?: ErrorOptions);
}
/**
 * Thrown when a network request fails (server unreachable, no internet, etc.)
 * This error triggers the root error boundary with retry capability.
 *
 * @example
 * ```typescript
 * try {
 *   await fetch(url);
 * } catch (error) {
 *   if (error instanceof TypeError) {
 *     throw new NetworkError("Unable to connect to server", { cause: error });
 *   }
 *   throw error;
 * }
 * ```
 */
export declare class NetworkError extends Error {
    name: "NetworkError";
    cause?: unknown;
    /** The URL that failed to fetch */
    url?: string;
    /** Whether this was during an action, navigation, or revalidation */
    operation?: "action" | "navigation" | "revalidation";
    constructor(message?: string, options?: ErrorOptions & {
        url?: string;
        operation?: "action" | "navigation" | "revalidation";
    });
}
/**
 * Check if an error is a network-level failure (server unreachable, no internet)
 * These are typically TypeError from fetch when the network request itself fails.
 */
export declare function isNetworkError(error: unknown): boolean;
/**
 * Structured error for JSON response routes.
 * Thrown by handlers to return a typed error envelope with a specific HTTP status.
 *
 * Unlike standard Error, RouterError messages are always exposed to the client
 * (the developer intentionally crafted them for consumers).
 *
 * @example
 * ```typescript
 * path("/products/:id", (ctx) => {
 *   const product = products.find(p => p.id === ctx.params.id);
 *   if (!product) throw new RouterError("NOT_FOUND", "Product not found", { status: 404 });
 *   return product;
 * }, { name: "productDetail" })
 * ```
 */
export declare class RouterError extends Error {
    name: "RouterError";
    code: string;
    type?: string;
    status: number;
    cause?: unknown;
    constructor(code: string, message: string, options?: {
        status?: number;
        type?: string;
        cause?: unknown;
    });
}
/**
 * Thrown when route handler returns invalid type
 */
export declare class InvalidHandlerError extends Error {
    name: "InvalidHandlerError";
    cause?: unknown;
    constructor(message: string, options?: ErrorOptions);
}
/**
 * Internal invariant assertion for development-time checks
 *
 * @internal
 * @param condition - Condition that must be true
 * @param message - Error message to throw if condition is false
 * @throws {Error} If condition is false
 *
 * @example
 * ```typescript
 * invariant(user !== null, 'User must be defined');
 * invariant(node.type === 'layout', `Expected layout, got ${node.type}`);
 * ```
 */
export declare function invariant(condition: any, message: string): asserts condition;
/**
 * Sanitize errors for production - prevents leaking sensitive information
 *
 * SECURITY CRITICAL:
 * - In production: NEVER send stack traces, file paths, or internal state
 * - In development: Show full error details for debugging
 * - ALWAYS consume error.stack to prevent memory leaks
 *
 * @param error - Error to sanitize
 * @returns Response suitable for sending to client
 */
export declare function sanitizeError(error: unknown): Response;
export {};
//# sourceMappingURL=errors.d.ts.map