Hands any rejection back as an Error, passing an Error (the SDK's JsonRpcError too) through untouched and wrapping anything else with the raw value on cause.
Error
JsonRpcError
cause
toError({ code: 4001, message: 'User rejected' }).message // 'User rejected'toError({ status: 'error', error: 3 }).message // 'Wallet request failed'toError('nope').cause // 'nope' Copy
toError({ code: 4001, message: 'User rejected' }).message // 'User rejected'toError({ status: 'error', error: 3 }).message // 'Wallet request failed'toError('nope').cause // 'nope'
Hands any rejection back as an
Error, passing anError(the SDK'sJsonRpcErrortoo) through untouched and wrapping anything else with the raw value oncause.