@deployport/specular-runtime
Version:
Runtime for Specular API clients with support for Node.js and Browser
27 lines (26 loc) • 1.09 kB
TypeScript
/**
* RpcError is the base class for every error surfaced from a specular call:
* built-in protocol errors, user-defined errors, and the generic
* {@link UnknownRpcError} produced when the client cannot resolve the error
* type.
*/
export declare class RpcError extends Error {
constructor(message?: string);
}
/**
* UnknownRpcError is thrown when the server returns an error whose type the
* client was not generated with knowledge of (for example a newer server
* introduced an error type after the client was generated).
*
* It is still a catchable {@link RpcError} while exposing the raw payload so
* forward-compatible code can read the fields it knows.
*/
export declare class UnknownRpcError extends RpcError {
/** Fully-qualified type name (e.g. application/spec.ns.mod.type) advertised by the server. */
readonly typeName: string;
/** Machine-readable code, when discoverable in the payload. */
readonly code?: string;
/** Raw, undecoded error payload. */
readonly payload: unknown;
constructor(typeName: string, payload: unknown);
}