Checks if an exception or any of its previous exceptions is a PDOException.

@param \Exception $exception The exception.
@return boolean True if there's a PDOException.
546032
private static function hasPDOException(\Exception $exception)
    {
        if ($exception instanceof \PDOException) {
            return true;
        }
        if ($exception->getPrevious() === null) {
            return false;
        }
        return self::hasPDOException($exception->getPrevious());
    }
437689
public static function assertTrue($condition, Throwable $exception): bool
    {
        static::makeAssertion(true === $condition, $exception);
        return true;
    }
416964
protected function _logException(Exception $exception) {
		if ($this->is404($exception)) {
			$level = LOG_ERR;
			Log::write($level, $this->_getMessage($exception), ['404']);
			return false;
		}
		return parent::_logException($exception);
	}
850982
private function formatException(\Exception $exception)
    {
        $result = [
            'message' => $exception->getMessage(),
            'type'      => get_class($exception),
            'code'      => $exception->getCode(),
            'trace' => [
                [
                    'file' => $exception->getFile() ?: 'unknown',
                    'line' => $exception->getLine() ?: 'unknown',
                ]
            ]
        ];

        foreach ($exception->getTrace() as $frame) {
            $result['trace'][] = $this->formatStackFrame($frame);
        }

        if ($previous = $exception->getPrevious()) {
            $result['previous'] = $this->formatException($previous);
        }

        return $result;
    }
1098703
public function handleException(Exception $exception) {
        // untangle message from php7errorexception
        $message = $exception instanceof PHP7ErrorException ? $exception->getError()->getMessage(): $exception->getMessage();

        // send a debug mail with the exception
        if(!$this->debug && !in_array(get_class($exception), $this->_skipExceptions))
            $this->_email('CLI Exception', Misc::dump($exception, $message, true));

        // continue with exception handle logic
        parent::handleException($exception);
    }
1152121
public function formatException(Exception $exception)
    {
        if ($exception instanceof HttpException) {
            return $this->formatter->formatResponse($exception->getResponse());
        }

        if ($exception instanceof TransferException || $exception instanceof NetworkExceptionInterface) {
            return sprintf('Transfer error: %s', $exception->getMessage());
        }

        return sprintf('Unexpected exception of type "%s": %s', get_class($exception), $exception->getMessage());
    }
385355
protected function throwError($exception)
    {
        switch ($exception->getResponse()->getStatusCode()) {
            case 400:
                throw new BadRequestException($exception);
                break;

            case 401:
                throw new UnauthorizedException($exception);
                break;

            case 403:
                throw new MethodNotAllowedException($exception);
                break;

            case 404:
                throw new NotFoundException($exception);
                break;

            default:
                throw new Exception($exception);
                break;
        }
    }
900745
protected function logException(\Exception $exception)
    {
        try {
            $this->logger->error($exception->getMessage() , array('exception' => $exception));
        } catch (\Exception $exception) {
            trigger_error("Error logging Monitor exception: ".$exception->getMessage());
        }
    }
1077015
protected function shouldntBacktrace(Exception $e)
    {
        foreach ($this->dontBacktrace as $type) {
            if ($e instanceof $type) {
                return true;
            }
        }
        
        return false;
    }
1105362
protected static function getFirstException(\Exception $exception)
    {
        if (null !== $exception->getPrevious()) {
            return static::getFirstException($exception->getPrevious());
        }

        return $exception;
    }
1206785
public static function onException( $exception )
    {
        $_trace = $exception->getTrace();
        $_traceText = static::_cleanTrace( $_trace, 3 );

        if ( E_NOTICE == $exception->getCode() )
        {
            return false;
        }

        static::$_error = array(
            'code'       => $exception->getCode(),
            'type'       => '',
            'message'    => $exception->getMessage(),
            'file'       => $exception->getFile(),
            'line'       => $exception->getLine(),
            'trace'      => $_traceText,
            'traces'     => $exception->getTrace(),
            'source'     => static::_getCodeLines( $exception->getFile(), $exception->getLine(), static::$_sourceLines ),
            'start_line' => static::$_startLine,
        );

        Log::error( static::$_error['message'] . ' (' . static::$_error['code'] . ')' );

        return static::renderError();
    }
472961
private function rollBack(\Exception $exception)
    {
        try {
            $this->pdo->rollBack();
        } catch (\PDOException $e2) {
            throw new LockAcquireException(
                "Could not roll back transaction: {$e2->getMessage()})",
                0,
                $exception
            );
        }
    }
1127210
public static function throwError(&$exception)
    {
        if ($exception instanceof \Exception) {
            if ($exception instanceof \JException) {
                $level = $exception->get('level');
                if (!(JOMMLA_ERROR_LEVEL & $level)) {
                    return parent::throwError($exception);
                }
            }
            throw $exception;
        }

        return parent::throwError($exception);
    }
1285722
public function PHPExceptionHandler($exception)
    {
        session_write_close();
        $message = $exception->getMessage() . ' | File: {file} | Ln: {line} | ST: {stacktrace}';
        $context = array(
            'file' => $exception->getFile(),
            'line' => $exception->getLine(),
            'stacktrace' => $exception->getTraceAsString()
        );
        $this->logger->log($this->exceptionLogLevel, $message, $context);
    }
1342812
protected function shouldReport( Exception $e )
	{
		foreach ( $this->dontReport as $type )
			if ( $e instanceof $type )
				return false;

		return true;
	}
1371386
protected function shouldExceptionBeLogged(Throwable $exception): bool
	{
		if($this->logger === null)
		{
			return false;
		}

		foreach($this->disableLoggingFor as $exceptionType)
		{
			if($exception instanceof $exceptionType)
			{
				return false;
			}
		}

		return true;
	}
31983
public function exceptionHandler($exception)
    {
        $this->lastHandledException = $exception;

        $this->client->catchException($exception);

        if ($this->oldExceptionHandler) {
            call_user_func(
                $this->oldExceptionHandler,
                $exception
            );
        }
    }