/**
 * Error handling utilities for the Host application.
 *
 * Provides a consistent way to create error responses matching
 * the MessageError format defined in @pocketcoder/shared.
 */
import type { MessageError } from "@pocketcoder/shared";
import { ErrorCode } from "@pocketcoder/shared/constants";
export { ErrorCode };
/**
 * Create a formatted error object matching the MessageError interface.
 *
 * @param code - ErrorCode enum value
 * @param message - Human-readable error description
 * @param details - Optional additional context
 */
export declare function createError(code: ErrorCode, message: string, details?: Record<string, unknown>): MessageError;
/**
 * Application-level error class that carries an ErrorCode.
 * Handlers can throw this and the router/catch block can extract
 * structured error information.
 */
export declare class AppError extends Error {
    readonly code: ErrorCode;
    readonly details?: Record<string, unknown>;
    constructor(code: ErrorCode, message: string, details?: Record<string, unknown>);
    /** Convert to a MessageError for sending over the wire. */
    toMessageError(): MessageError;
}
/**
 * Extract a MessageError from an unknown caught value.
 * If the value is an AppError, uses its code and details.
 * Otherwise falls back to UNKNOWN_ERROR.
 */
export declare function toMessageError(err: unknown): MessageError;
//# sourceMappingURL=index.d.ts.map