Handles a bad response when attempting to revalidate

@param BadResponseException $e Exception encountered

@throws BadResponseException
496190
protected function handleBadResponse(BadResponseException $e)
    {
        // 404 errors mean the resource no longer exists, so remove from
        // cache, and prevent an additional request by throwing the exception
        if ($e->getResponse()->getStatusCode() == 404) {
            $this->storage->delete($e->getRequest());
            throw $e;
        }
    }
924965
public function handle($e)
	{
		$this->logException($e);

		if ($this->isExceptionHalting($e))
		{
			// if headers are sent, we can't send a response
			if(headers_sent())
			{
				echo $this->buildResponseBody($e);
				exit(0);
			}

			// send it off
			$sender = new Http\ResponseSender($this->buildResponse($e));
			$sender->send();

			if (ob_get_level() > 0) ob_flush();
			exit(self::EXIT_CODE);
		}
	}
638534
protected function deleteActionException(\Exception $e)
    {
        $this->handleException($e);

        return new RedirectResponse($this->admin->generateUrl('list'));
    }
71375
private function returnGeneralErrorResponse($e)
    {
        $backtrace = $this->config('debug.backtrace')? ['error' => ['backtrace' => $e->getTrace()]] : [];
        return $this->response->error($e->getCode(), $e->getMessage(), $backtrace);
    }
1297065
protected function handleBadUserRoleException(GetResponseForExceptionEvent $event, BadUserRoleException $ex) {
        if (null !== $ex->getRedirectUrl()) {
            $event->setResponse(new RedirectResponse($ex->getRedirectUrl()));
        }
        return $event;
    }
15346
public function handle(ClientException $e)
    {
        throw new RequestFailedException(
            $e->getMessage(),
            $e->getCode(),
            null,
            $e->getResponse()
        );
    }
1362974
protected function renderHttpResponse(Exception $e)
    {
        $this->getExceptionHandler()->render($this->app['request'], $e)->send();
    }
1035668
private function handleException($app, Exception $e)
    {
        $status = $e->getCode();
        $statusText = \Slim\Http\Response::getMessageForCode($status);

        if ($statusText === null) {
            $status = 500;
            $statusText = 'Internal Server Error';
        }

        $app->response->setStatus($status);
        $app->response->headers->set('Content-Type', 'application/json');
        $app->response->setBody(json_encode(array(
            'status' => $status,
            'statusText' => preg_replace('/^[0-9]+ (.*)$/', '$1', $statusText),
            'description' => $e->getMessage(),
        )));

        $app->response()->finalize();

        return $app->response();
    }
118049
protected function processApiResponseContextErrors(ResponseContextAbstract $responseContext): void
    {
        if ($responseContext->hasHttpError()) {
            throw new BadResponseContextException(
                $responseContext->getHttpStatusMessage(),
                $responseContext->getHttpStatusCode()
            );
        }
    }
265177
function onMvcErrorInjectResponse($e)
    {
        // Do nothing if no error in the event
        $error = $e->getError();
        if(empty($error) || !$error instanceof \Exception)
            // We do nothing without Exception
            return;

        if ($e->getResult() instanceof Response)
            $e->setResponse($e->getResult());

        // Set Response Status Code >>>> {
        /** @var \Zend\Http\PhpEnvironment\Response $response */
        $response = $e->getResponse();
        if (!$response) {
            $response = new Response();
            $e->setResponse($response);
        }

        if ($response->getStatusCode() === 200)
            // Change Response Code only if is Success
            $response->setStatusCode(
                $this->__getResponseCodeFromException($error)
            );
        // <<<< }

        $this->error = $error;
    }
1159821
public void doneWithInvalidResponse(InvalidResponseException e) {
        lock.lock();
        try {
            illegalResponseException = e;
            condition.signal();
        } finally {
            lock.unlock();
        }
    }
1332700
public function handleError(\Error $e): Response
    {
        $this->logger->error(sprintf('%s in %s:%d', $e->getMessage(), $e->getFile(), $e->getLine()));
        return $this->providePhpErrorResponse($e);
    }
883468
public function badRequest(BadRequestException $exception, ServerRequestInterface $request) : ResponseInterface
    {
        $this->exception = $exception;

        $acceptType = $request->getHeader('Accept');
        if (is_array($acceptType) && count($acceptType) > 0 && strpos($acceptType[0], 'json') !== false) {
            return new JsonResponse(['error' => ['message' => 'Bad request sent', 'type' => 'bad_request']], 400);
        }

        if ($this->contentFor400) {
            $this->contentBlock = $this->contentFor400;
        } else {
            $this->contentBlock->addFile(__DIR__ . '/../../../../views/400.php', $this);
        }

        return HtmlResponse::create($this->template, 400);
    }
1152111
protected function prepareResponse($request, Exception $e)
    {
        if (! $this->isHttpException($e) && config('app.debug')) {
            return $this->toIlluminateResponse($this->convertExceptionToResponse($e), $e);
        }

        if (! $this->isHttpException($e)) {
            $e = new HttpException(500, $e->getMessage());
        }

        return $this->toIlluminateResponse(
            $this->renderHttpException($e), $e
        );
    }
1212420
public static function handleError(BadResponseException $exception)
    {
        $response_body = (string) $exception->getResponse()->getBody();
        $array_body = decode($response_body);

        $code = $exception->getResponse()->getStatusCode();

        $lookForKeys = ['message', 'code', 'error'];

        foreach ($lookForKeys as $key) {
            if (isset($array_body[$key])) {
                $message = $array_body[$key];
            }
        }

        if (!$message) {
            $message = 'unknown_error';
        }

        throw new JSONError($message, $code, $array_body);
    }
1249990
public function failed($e)
    {
        $this->markAsFailed();

        $payload = $this->payload();

        list($class, $method) = $this->parseJob($payload['job']);

        if (method_exists($this->instance = $this->resolve($class), 'failed')) {
            $this->instance->failed($payload['data'], $e);
        }
    }
584219
protected function handleCancel(CancellationException $e): ?string
    {
        throw $this->closed ? ($e->getPrevious() ?? $e) : $e;
    }