Middleware that will call handler whenever an RPC error happens,
with the error object itself.
The handler can either return nothing
(in which case the original error will be thrown), a new error
(via the _: 'mt_rpc_error' object), or any other value, which
will be returned as the result of the RPC call.
Note that the return value is not type-checked
due to limitations of TypeScript. You'll probably want to use satisfies
keyword to ensure the return value is correct, for example:
Middleware that will call
handler
whenever an RPC error happens, with the error object itself.The handler can either return nothing (in which case the original error will be thrown), a new error (via the
_: 'mt_rpc_error'
object), or any other value, which will be returned as the result of the RPC call.Note that the return value is not type-checked due to limitations of TypeScript. You'll probably want to use
satisfies
keyword to ensure the return value is correct, for example: