'Report the response as a failure.
exc can be either a python exception, or a string in which case it will
be wrapped inside a CatchResponseError.
Example::
with self.client.get("/", catch_response=True) as response:
if response.content == "":
response.failure("No data")'

def failure(self, exc):

    if isinstance(exc, six.string_types):
        exc = CatchResponseError(exc)
    events.request_failure.fire(request_type=self.locust_request_meta['method'], name=self.locust_request_meta['name'], response_time=self.locust_request_meta['response_time'], exception=exc)
    self._is_reported = True
