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