Specialized error handling for RPC methods.

Instances of this type, when thrown in a method handler, will have their message serialized and sent across the wire. The sender will receive an equivalent error on the other side.

Built-in types are included but developers may use any string, with a max length of 256 bytes.

Hierarchy

  • Error
    • RpcError

Constructors

  • Creates an error object with the given code and message, plus an optional data payload.

    If thrown in an RPC method handler, the error will be sent back to the caller.

    Error codes 1001-1999 are reserved for built-in errors (see RpcError.ErrorCode for their meanings).

    Parameters

    • code: number
    • message: string
    • Optionaldata: string

    Returns RpcError

Properties

code: number
data?: string
ErrorCode: {
    APPLICATION_ERROR: 1500;
    CONNECTION_TIMEOUT: 1501;
    RECIPIENT_DISCONNECTED: 1503;
    RECIPIENT_NOT_FOUND: 1401;
    REQUEST_PAYLOAD_TOO_LARGE: 1402;
    RESPONSE_PAYLOAD_TOO_LARGE: 1504;
    RESPONSE_TIMEOUT: 1502;
    SEND_FAILED: 1505;
    UNSUPPORTED_METHOD: 1400;
    UNSUPPORTED_SERVER: 1403;
    UNSUPPORTED_VERSION: 1404;
} = ...
MAX_DATA_BYTES: number = 15360
MAX_MESSAGE_BYTES: number = 256