@param ClientException $e

@throws RequestFailedException
15346
public function handle(ClientException $e)
    {
        throw new RequestFailedException(
            $e->getMessage(),
            $e->getCode(),
            null,
            $e->getResponse()
        );
    }
1050441
public static function wrapException(RequestInterface $request, \Exception $e)
    {
        return $e instanceof RequestException
            ? $e
            : new RequestException($e->getMessage(), $request, null, $e);
    }
495899
public function validateRequest(Request $request): ResponseInterface
    {
        $case = $this->makeCase($request);

        $caseId = $this->getApiClient()->createCase($case);

        if (!$caseId) {
            throw new RequestException(
                'Could not create Signifyd Case: '
                . $this->getApiClient()->getLastErrorMessage()
            );
        }

        return new CaseIdResponse($caseId);
    }
864800
private function _throwServerError(\Exception $e) {
		$uri = (string) $this->httpClient->getConfig('base_uri');

		throw new ServerErrorHttpException(get_class($e).': url='.$uri .' '. $e->getMessage(), 500);
	}
911272
public function fail($e = null)
    {
        $this->markAsFailed();

        if ($this->isDeleted()) {
            return;
        }

        try {
            // If the job has failed, we will delete it, call the "failed" method and then call
            // an event indicating the job has failed so it can be logged if needed. This is
            // to allow every developer to better keep monitor of their failed queue jobs.
            $this->delete();

            $this->failed($e);
        } finally {
            $this->resolve(Dispatcher::class)->dispatch(new JobFailed(
                $this->connectionName, $this, $e ?: new ManuallyFailedException
            ));
        }
    }
850370
public function onClientRequest(RequestEvent $event)
    {
        $errors = $this->validator->validate($event->getRequest());

        if (count($errors)) {
            throw new RequestException((string) $errors);
        }
    }
1056920
private function handleForConsole(Exception $e)
    {
        if ($e instanceof StopException) {
            $output = $e->getMessage();
        }
        else {
            $data = $this->convertException($e);
            $class = get_class($e);
            $file  = $this->stripFile($data['file']);
            $line  = $data['line'];
            $code  = $data['code'];

            // set the error message
            if ($e instanceof HttpException) {
                $message = http_status_text($data['status']) . ' (' . $data['status'] . ')';
                if (!empty($data['message'])) {
                    $message .=  '. ' . $data['message'];
                }
            }
            else if ($e instanceof QueryException) {
                $message = $data['message'] . '; sql: ' . $data['sql'];
            }
            else {
                $message = $data['message'];
            }

            $output = $class . ' in "' . $file . '", line ' . $line . ':' . PHP_EOL . $message . ' (code ' . $code . ')';
        }

        stdio()->error($output);

        $exitCode = $e->getCode();
        if ($exitCode === null) {
            $exitCode = Command::EXIT_FAILURE;
        }

        exit ($exitCode);
    }
1075516
public function report(ServerRequestInterface $request, Throwable $e): void
    {
        call_user_func_array($this->callable, [$request, $e]);
    }
1024321
protected function processException(RequestException $exception): void
    {
        $requestContents = $this->getContentsFromMessage($exception->getRequest());
        $responseContents = $this->getContentsFromMessage($exception->getResponse());

        if ($exception instanceof ConnectException) {
            throw new ConnectionException($exception->getMessage(), $requestContents, $exception);
        } else {
            $message = $this->extractMessageFromErrorResponse($responseContents, $exception->getMessage());
            $statusCode = 0;
            if ($exception->getResponse() instanceof PsrResponseInterface) {
                $statusCode = $exception->getResponse()->getStatusCode();
            }

            throw $this->createApiClientException($statusCode, $message, $requestContents, $responseContents);
        }
    }
489994
protected function throwRequestException(RequestException $requestException)
    {
        $exceptionParts = $this->getRequestExceptionParts($requestException);

        $exception = new Exceptions\Exception(
            $exceptionParts['reason'],
            $exceptionParts['code'],
            $requestException
        );

        $body = $exceptionParts['body'];
        $json = json_decode($body);

        if (json_last_error() == JSON_ERROR_NONE) {
            throw $exception->setResponseBody($json);
        }

        throw $exception->setResponseBody($body);
    }
166495
private function handleRequestException(HttpClientException $e)
    {
        if ($response = $e->getResponse()) {
            $exception = new Exception($response->getReasonPhrase(), $response->getStatusCode(), $e);
            $exception->setBody(json_decode($response->getBody()));

            throw $exception;
        }

        throw new Exception($e->getMessage(), 500, $e);
    }
1002705
public function handleException(\Throwable $e)
	{
        // headers sent by browser are prefixed with 'HTTP' (so that they don't mess with environment variables), and - are replaced by _
        if ( (strpos($_SERVER['HTTP_USER_AGENT'], 'XMLHTTP') === 0) || (strpos($_SERVER['HTTP_ACCEPT'], 'application/json') === 0) )
            // if XMLHTTP request
            $this->_handleXMLHTTPCommandException($e);

        // if GET/POST request
        else
            $this->_handleGETPOSTException($e);
        
        die();
    }
993779
protected function handleBeginTransactionException($e)
    {
        if ($this->causedByLostConnection($e)) {
            $this->reconnect();

            $this->pdo->beginTransaction();
        } else {
            throw $e;
        }
    }
787510
protected function renderException(Request $request, Exception $e)
    {
        return $this->app['Nano7\Foundation\Contracts\Exception\ExceptionHandler']->render($request, $e);
    }
395399
protected function sendExceptionToHandler($e)
    {
        $handler = $this->resolveExceptionHandler();

        if ($e instanceof Error) {
            $e = new FatalThrowableError($e);
        }

        $handler->report($e);

        return $handler->render($this->make('request'), $e);
    }
657187
public function render(Request $request, Exception $e)
    {
        $e = $this->prepareException($e);

        if ($e instanceof HttpResponseException) {
            return $e->getResponse();
        } else if ($e instanceof AuthenticationException) {
            return $this->unauthenticated($request, $e);
        } else if ($e instanceof ValidationException) {
            return $this->convertValidationExceptionToResponse($e, $request);
        }

        return $this->prepareResponse($request, $e);
    }
66286
protected function determineException(ClientException $exception): Exception
    {
        if (in_array($exception->getResponse()->getStatusCode(), [400, 403, 404, 409])) {
            return new BadRequest($exception->getResponse());
        }

        return $exception;
    }