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