@simple_decorator
def fault2error(func):
    '\n    Catch known XML-RPC faults and translate them to\n    custom exceptions.\n    '

    def catcher(*args):
        try:
            return func(*args)
        except xmlrpc.client.Fault as error:
            error_classes = (GameError, RuleError, ProtocolError)
            for klass in error_classes:
                if (error.faultCode == klass.rpc_code):
                    raise klass(error.faultString)
            raise error
    return catcher
Catch known XML-RPC faults and translate them to
custom exceptions.
@simple_decorator
def fault2error(func):
    '\n    Catch known XML-RPC faults and translate them to\n    custom exceptions.\n    '

    def catcher(*args):
        try:
            return func(*args)
        except xmlrpc.client.Fault as error:
            error_classes = (GameError, RuleError, ProtocolError)
            for klass in error_classes:
                if (error.faultCode == klass.rpc_code):
                    raise klass(error.faultString)
            raise error
    return catcher