Add openethereum error parser, add dialect processor to config from args
This commit is contained in:
9
chainlib/eth/dialect/__init__.py
Normal file
9
chainlib/eth/dialect/__init__.py
Normal file
@@ -0,0 +1,9 @@
|
||||
# local imports
|
||||
from chainlib.eth.error import EthException
|
||||
|
||||
|
||||
class DefaultErrorParser:
|
||||
"""Generate eth specific exception for the default json-rpc query error parser.
|
||||
"""
|
||||
def translate(self, error):
|
||||
return EthException('default parser code {}'.format(error))
|
||||
17
chainlib/eth/dialect/openethereum.py
Normal file
17
chainlib/eth/dialect/openethereum.py
Normal file
@@ -0,0 +1,17 @@
|
||||
# standard imports
|
||||
import logging
|
||||
|
||||
# local imports
|
||||
from chainlib.eth.dialect import DefaultErrorParser
|
||||
from chainlib.error import RPCNonceException
|
||||
|
||||
logg = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class DialectErrorParser(DefaultErrorParser):
|
||||
|
||||
def translate(self, error):
|
||||
if error['error']['code'] == -32010:
|
||||
if 'nonce is too low' in error['error']['message']:
|
||||
return RPCNonceException(error)
|
||||
return super(DialectErrorParser, self).translate(error)
|
||||
Reference in New Issue
Block a user