Exemple #1
0
    def request_replay(after):
        after = float(after)

        if after <= 0:
            raise ActionInvocationException('Illegal replay interval: %.2f' % after)

        raise ReplayRequested(at=time.time() + after)
Exemple #2
0
    def run(self):
        try:
            return self._run()

        except ReplayRequested as rr:
            replay(request.path, request.method, request.headers, request.json, rr.at)

        except Exception as ex:
            cause = _CauseTraceback()
            traceback.print_exc(file=cause)

            raise ActionInvocationException('Failed to invoke %s.run:\n'
                                            '  Reason (%s): %s\n'
                                            'Cause:\n%s' %
                                            (type(self).__name__, type(ex).__name__, ex, cause))
 def _run(self):
     raise ActionInvocationException("%s.run not implemented" %
                                     type(self).__name__)
    def error(self, message=""):
        if not message:
            message = 'The "%s" action threw an error' % self.action_name

        raise ActionInvocationException(message)