chainlib-eth/chainlib/eth/error.py
2021-08-21 07:27:40 +00:00

34 lines
799 B
Python
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# local imports
from chainlib.error import ExecutionError
class EthException(Exception):
"""Base class for all Ethereum related errors.
"""
pass
class RevertEthException(EthException, ExecutionError):
"""Raised when an rpc call or transaction reverts.
"""
pass
class NotFoundEthException(EthException):
"""Raised when rpc query is made against an identifier that is not known by the node.
"""
pass
class RequestMismatchException(EthException):
"""Raised when a request data parser is given unexpected input data.
"""
pass
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))