UNPKG

ws-rmi

Version:

A Remote Method Invocation implementation written in JavaScript utilising the WebSocket protocol

24 lines (23 loc) 965 B
import { RMIMessage } from "./RMIMessage"; export declare type RMIRemoteErrorData = { /** * The cause of the error. */ error: string; }; /** * Represents an error that occurred during invocation of an exposed RMI function. */ export declare type RMIRemoteError = RMIMessage<"RESPONSE_ERROR", RMIRemoteErrorData>; /** * Creates an object adhering to the RMI Remote Error schema. * * @param id The ID of the message to use. * @param error The error that occurred on the remote. NOTE: This should be generic to avoid clients obtaining * potentially sensitive information about the remote, such as stack trace, etc. */ export declare const createRMIRemoteError: (id: string, error: string) => RMIRemoteError; /** * Validates that the given message is an RMI remote error. */ export declare const validateRMIRemoteError: (message: unknown) => message is RMIMessage<import("./RMIMessageType").RMIMessageType, RMIRemoteErrorData>;