mirror of
https://github.com/status-im/nim-ethers.git
synced 2025-01-14 01:26:24 +00:00
131316de08
Ensures that provider no longer needs to know about error conversion, it now localized in contract.nim. Co-Authored-By: Eric Mastro <eric.mastro@gmail.com>
16 lines
456 B
Nim
16 lines
456 B
Nim
import ../basics
|
|
import ../provider
|
|
import ./encoding
|
|
|
|
type ConvertCustomErrors* =
|
|
proc(error: ref ProviderError): ref EthersError {.gcsafe, raises:[].}
|
|
|
|
func customErrorConversion*(ErrorTypes: type tuple): ConvertCustomErrors =
|
|
func convert(error: ref ProviderError): ref EthersError =
|
|
if data =? error.data:
|
|
for e in ErrorTypes.default.fields:
|
|
if error =? typeof(e).decode(data):
|
|
return error
|
|
return error
|
|
convert
|