Exemplo n.º 1
0
def test_get_timeout_for_failure_with_3rd_party_exception():
    class UnknownException(Exception):
        pass

    # verify it isn't yet registered
    with pytest.raises(Exception, match="Unknown failure type"):
        get_timeout_for_failure(UnknownException())

    register_error(UnknownException, 1234)

    assert get_timeout_for_failure(UnknownException()) == 1234
Exemplo n.º 2
0
     - missing tables
    """
    pass


class AttestationNotFound(BaseTrinityError):
    """
    Raised when attestion with given attestation root does not exist.
    """
    pass


class WrongNetworkFailure(HandshakeFailure):
    """
    Disconnected from the peer because it's on a different network than we're on
    """
    pass


register_error(WrongNetworkFailure, BLACKLIST_SECONDS_WRONG_NETWORK_OR_GENESIS)


class WrongGenesisFailure(HandshakeFailure):
    """
    Disconnected from the peer because it has a different genesis than we do
    """
    pass


register_error(WrongGenesisFailure, BLACKLIST_SECONDS_WRONG_NETWORK_OR_GENESIS)
Exemplo n.º 3
0
class OversizeObject(BaseTrinityError):
    """
    Raised when an object is bigger than comfortably fits in memory.
    """
    pass


class DAOForkCheckFailure(BaseP2PError):
    """
    Raised when the DAO fork check with a certain peer is unsuccessful.
    """
    pass


register_error(DAOForkCheckFailure, BLACKLIST_SECONDS_DAO_FORK_CHECK_FAILURE)


class BadDatabaseError(BaseTrinityError):
    """
    The local network database is not in the expected format
     - empty
     - wrong schema version
     - missing tables
    """
    pass


class AttestationNotFound(BaseTrinityError):
    """
    Raised when attestion with given attestation root does not exist.