import type { ErrorCode, RPCError } from './types.js'; /** * RPC Exception class for structured error handling */ export declare class RPCException extends Error { readonly code: ErrorCode | string; readonly data?: any; constructor(code: ErrorCode | string, message: string, data?: any); /** * Create exception from JSON error object */ static fromJSON(error: RPCError): RPCException; /** * Convert exception to JSON-serializable format */ toJSON(): RPCError; } /** * Helper function to create RPC exceptions */ export declare function createError(code: ErrorCode | string, message: string, data?: any): RPCException; /** * Type guard to check if error is an RPC exception */ export declare function isRPCError(error: any): error is RPCException; /** * Mark an error this client raised for a no-responder status it saw itself. * A handler that passes such an error on reports `upstream unavailable` * instead, so its caller does not take it for a missing responder of its own. * * Internal: client.ts and handler.ts use it. */ export declare function markLocalNoResponders(error: E, subject: string): E; /** * The subject of a no-responder error from markLocalNoResponders(), * undefined for any other value. * * Internal: handler.ts uses it. */ export declare function localNoRespondersSubject(error: unknown): string | undefined; /** * Check whether an error is a NATS "no responders" error — i.e. nobody is * subscribed to the requested subject (the target service is not running). */ export declare function isNoRespondersError(error: unknown): boolean;