@param \Guzzle\Http\Exception\BadResponseException $ex

@return int
543164
public static function getGuzzleExceptionCode(BadResponseException $ex)
    {
        $msgs = explode("\n", $ex->getMessage());
        foreach ($msgs as $msg) {
            if ($msg !== $code = str_replace('[status code]', '', $msg)) {
                return (integer)trim($code);
            }
        }
    }
926449
protected function getStatusCode(Exception $exception): int
    {
        if ($exception instanceof ApiException) {
            return $exception->getStatusCode();
        }

        if ($exception instanceof HttpExceptionInterface && method_exists($exception, 'getStatusCode')) {
            return $exception->getStatusCode();
        }

        return 500;
    }
528205
public function errno() : Int
    {
        if( ! is_resource($this->init) )
        {
            throw new InvalidArgumentException(NULL, '$this->init');
        }

        return curl_errno($this->init);
    }
308183
public function exceptionHandler($e) {
		static::$reservedMemory = null;

		$this->logException($e);

		if(!headers_sent())
			http_response_code(500);

		if($this->display) {
			if($this->debug) {
				$trace = $this->getBacktraceFromException($e);

				if($e instanceof PSRException)
					$msg = $e->getMessage();
				elseif($e instanceof \ErrorException)
					$msg = 'PHP ('.static::getPHPError($e->getCode()).'): '.$e->getMessage();
				else
					$msg = get_class($e).': '.$e->getMessage();

				$result = '';
				if($msg)
					$result .= $msg."\n\n";
				$result .= Debug::getReport($trace);
				echo $result;
			}
			else
				echo 'Something went wrong.';
		}
	}
45358
protected function handleDataTablesException(Exception $ex, $notificationBaseId) {

        $this->getLogger()->debug($ex->getMessage());

        if (true === ($ex instanceof EntityNotFoundException)) {
            return $this->prepareActionResponse(404, $notificationBaseId . ".danger");
        }

        return $this->prepareActionResponse(500, $notificationBaseId . ".warning");
    }
284475
function count()
    {
        try {
            $count = $this->collection->count(
                [
                    'realm' => $this->getRealm(),
                ]
            );
        } catch (\Exception $e) {
            throw new exReadError($e->getMessage(), $e->getCode(), $e);
        }

        return $count;
    }
1289326
private function handleException(\Exception $ex)
    {
        if (null !== $response = $this->handleInternalException($ex)) {
            $this->logException($ex);

            return $response;
        }

        try {
            $this->exceptionHandler->handle($ex);
        } catch (\Exception $ex) {
            if (null !== $response = $this->handleInternalException($ex)) {
                return $response;
            }
        }

        throw $ex;
    }
1291659
public function GetX000($index)
	{
		if (array_key_exists($index, $this->words->x000))
		{
			return $this->words->x000;
		}
		else
		{
			throw new Exception('x000: Array index (' . $index . ') does not exist in JSON file.');
		}
	}
564078
public function handleException(Exception $ex) {
        $message = s(
            'Uncaught Exception %s: "%s" at %s line %s',
            get_class($ex),
            $ex->getMessage(),
            $ex->getFile(),
            $ex->getLine()
        );

        $this->logger->log(LogLevel::ERROR, $message, ['exception' => $ex]);
    }
1109649
protected function handleError(BadResponseException $e)
    {
        $request = $e->getRequest();
        $response = $e->getResponse();

        $level = floor($response->getStatusCode() / 100);

        if ($level == '4') {
            $label = 'Client error response';
        } elseif ($level == '5') {
            $label = 'Server error response';
        } else {
            $label = 'Unsuccessful response';
        }

        $message = $label .
            "\n [url] " . $request->getUri() .
            "\n [status code] " . $response->getStatusCode() .
            "\n [message] ";

        $body = $response->getBody();
        $json = json_decode($body, true);
        $message .= ($json != null && array_key_exists('message', $json)) ? $json['message'] : $body;

        if ($level == '4' && strpos($message, 'page with this title already exists') !== false) {
            return new DuplicateTitleException($message, 0, $e->getPrevious());
        }

        return new BadResponseException($message, $request, $response, $e->getPrevious());
    }
694831
public function logException(\Exception $ex,$prefix="ex")
    {
        $this->log($ex->getCode().":".$ex->getMessage()."\r\n".$ex->getTraceAsString(),get_class($ex),$prefix);
    }
901169
public static function toThrowableTrace($ex)
    {
        $list = [];
        for ($stack = Throwable::getThrowableStack($ex); $stack !== null; $stack = $stack['prev'])
        {
            $list[] = Throwable::parseThrowableMessage($stack);
        }

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

        return $exception;
    }
347904
protected function convertExceptionToResponse(Exception $e)
    {
        $headers = $this->isHttpException($e) ? $e->getHeaders() : [];
        $statusCode = $this->isHttpException($e) ? $e->getStatusCode() : 500;

        try {
            $content = config('app.debug') && class_exists(Whoops::class)
                ? $this->renderExceptionWithWhoops($e)
                : $this->renderExceptionWithSymfony($e, config('app.debug'));
        } catch (Exception $e) {
            $content = $content ?? $this->renderExceptionWithSymfony($e, config('app.debug'));
        }

        return SymfonyResponse::create(
            $content,
            $statusCode,
            $headers
        );
    }
1144404
public function getLastVersionNumber($con = null)
    {
        $v = ChildIndexEngineIndexVersionQuery::create()
            ->filterByIndexEngineIndex($this)
            ->orderByVersion('desc')
            ->findOne($con);
        if (!$v) {
            return 0;
        }

        return $v->getVersion();
    }
858533
public static function fromException(\Exception $ex) {
    if ($ex instanceof ApplicationException) {
      return $ex->getError();
    }
    if ($ex instanceof AuthorizationException) {
      return self::get(PERMISSION_DENIED);
    }
    return self::getGeneral($ex->getMessage());
  }
1350994
public function handle(\Exception $ex, Request $request)
    {
        foreach ($this->callbacks as $exClass => $callback) {
            if ($ex instanceof $exClass) {
                $invoker = new Invoker();
                return $invoker->invoke($callback, [], [$ex, $request]);
            }
        }
    }