Home Reference Source
import ErrorHandler from '@token-io/core/src/http/ErrorHandler.js'
public class | source

ErrorHandler

RPC error handler that facilitates handling cross-cutting API errors. Converts generic StatusRuntimeException instances into specific Exception types to be handled by the callers.

The globalRpcErrorCallback is invoked with a {name, message} error object any time a custom RPC error occurs.

Constructor Summary

Public Constructor
public

constructor(globalRpcErrorCallback: function)

Creates the error handler instance.

Member Summary

Private Members
private

Method Summary

Public Methods
public

Handles RPC error and calls the globalRpcErrorCallback.

Public Constructors

public constructor(globalRpcErrorCallback: function) source

Creates the error handler instance.

Params:

NameTypeAttributeDescription
globalRpcErrorCallback function

callback to invoke on any cross-cutting RPC call error. For example: SDK version mismatch

Private Members

private _globalRpcErrorCallback: * source

Public Methods

public handleError(error: object): object source

Handles RPC error and calls the globalRpcErrorCallback.

Params:

NameTypeAttributeDescription
error object

error to handle

Return:

object

original RPC error