2024-03-19 09:39:32 +01:00
|
|
|
import ./basics
|
|
|
|
|
|
2024-11-28 14:48:10 +01:00
|
|
|
type
|
|
|
|
|
SolidityError* = object of EthersError
|
|
|
|
|
ContractError* = object of EthersError
|
|
|
|
|
SignerError* = object of EthersError
|
|
|
|
|
SubscriptionError* = object of EthersError
|
|
|
|
|
ProviderError* = object of EthersError
|
|
|
|
|
data*: ?seq[byte]
|
2025-05-27 18:03:19 +10:00
|
|
|
RpcNetworkError* = object of EthersError
|
|
|
|
|
RpcHttpErrorResponse* = object of RpcNetworkError
|
2025-05-28 19:26:10 +10:00
|
|
|
HttpRequestLimitError* = object of RpcHttpErrorResponse
|
|
|
|
|
HttpRequestTimeoutError* = object of RpcHttpErrorResponse
|
2024-03-19 09:39:32 +01:00
|
|
|
|
|
|
|
|
{.push raises:[].}
|
|
|
|
|
|
2024-11-28 14:48:10 +01:00
|
|
|
proc toErr*[E1: ref CatchableError, E2: EthersError](
|
|
|
|
|
e1: E1,
|
|
|
|
|
_: type E2,
|
|
|
|
|
msg: string = e1.msg): ref E2 =
|
|
|
|
|
|
|
|
|
|
return newException(E2, msg, e1)
|
2025-05-27 18:03:19 +10:00
|
|
|
|
|
|
|
|
proc raiseNetworkError*(
|
|
|
|
|
error: ref CatchableError) {.raises: [RpcNetworkError].} =
|
|
|
|
|
raise newException(RpcNetworkError, error.msg, error)
|