Ejemplo n.º 1
0
 def failure(reason):
     if reason.check(BadRequest):
         code = reason.value.code
         result = reason.value.result
     else:
         writeFailure(reason, logger, LOG_SYSTEM)
         code = INTERNAL_SERVER_ERROR
         result = incidentIdentifier
     request.setResponseCode(code)
     request.responseHeaders.setRawHeaders(b"content-type", [b"application/json"])
     return dumps(result)
Ejemplo n.º 2
0
 def failure(reason):
     if reason.check(BadRequest):
         code = reason.value.code
         result = reason.value.result
     else:
         writeFailure(reason, logger, LOG_SYSTEM)
         code = INTERNAL_SERVER_ERROR
         result = incidentIdentifier
     request.setResponseCode(code)
     request.responseHeaders.setRawHeaders(
         b"content-type", [b"application/json"])
     return dumps({u"error": True, u"result": result})
Ejemplo n.º 3
0
 def handle_error(failure):
     if failure.check(BadRequest):
         code = failure.value.code
         body = failure.value.result
     else:
         writeFailure(failure)
         # Ought to INTERNAL_SERVER_ERROR but Docker doesn't
         # seem to test that code path at all, whereas it does
         # have tests for this:
         code = OK
         body = {u"Err": u"{}: {}".format(failure.type.__name__, failure.value)}
     return EndpointResponse(code, body)
Ejemplo n.º 4
0
 def handle_error(failure):
     if failure.check(BadRequest):
         code = failure.value.code
         body = failure.value.result
     else:
         writeFailure(failure)
         # Ought to INTERNAL_SERVER_ERROR but Docker doesn't
         # seem to test that code path at all, whereas it does
         # have tests for this:
         code = OK
         body = {u"Err": u"{}: {}".format(failure.type.__name__,
                                          failure.value)}
     return EndpointResponse(code, body)
Ejemplo n.º 5
0
 def error(failure):
     writeFailure(failure, self.fsm.logger)
     # We should retry quickly to redo the failed work:
     return _UNCONVERGED_DELAY
Ejemplo n.º 6
0
 def error(failure):
     writeFailure(failure, self.fsm.logger)
     # We should retry to redo the failed work:
     return self._unconverged_sleep.sleep()
Ejemplo n.º 7
0
 def error(failure):
     writeFailure(failure, self.fsm.logger)
     # We should retry to redo the failed work:
     return self._unconverged_sleep.sleep()
Ejemplo n.º 8
0
 def error(failure):
     writeFailure(failure, self.fsm.logger)
     # We should retry quickly to redo the failed work:
     return _UNCONVERGED_DELAY