1.1.0 • Published 8 months ago
rpc-error v1.1.0
RPC errors
A class for handling RPC errors. Instances of RpcError
are assumed to be
public errors, which are safe to expose to the client.
import {RpcError} from 'rpc-error';
const error = RpcError.notFound();
Create a public "internal error":
const publicError = RpcError.from(privateError);
Create error using a custom code:
const error = RpcError.create('CUSTOM_ERROR_CODE');