Esempio 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)
Esempio 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})
Esempio 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)
Esempio 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)
Esempio n. 5
0
 def error(failure):
     writeFailure(failure, self.fsm.logger)
     # We should retry quickly to redo the failed work:
     return _UNCONVERGED_DELAY
Esempio n. 6
0
 def error(failure):
     writeFailure(failure, self.fsm.logger)
     # We should retry to redo the failed work:
     return self._unconverged_sleep.sleep()
Esempio n. 7
0
 def error(failure):
     writeFailure(failure, self.fsm.logger)
     # We should retry to redo the failed work:
     return self._unconverged_sleep.sleep()
Esempio n. 8
0
 def error(failure):
     writeFailure(failure, self.fsm.logger)
     # We should retry quickly to redo the failed work:
     return _UNCONVERGED_DELAY