src/Db/MySQL/AbstractMySQL.php
protected function setError(int $errorType = 0, string $className = ''): void
    {
        $errorMessage = '';
        if ($errorType == self::E_NO_CONNECTION) {
            $errorMessage = \sprintf(
                'FATAL ERROR (%s): Cannot establish connection to database server.',
                $this->currentLink->connect_errno
            );
        } elseif ($errorType == self::E_NO_DB_SELECTED) {
            $errorMessage = \sprintf(
                'FATAL ERROR (%s): Cannot select database \'%s\'.',
                $this->currentLink->errno,
                $this->selectedDB
            );
        } elseif ($errorType == self::E_NO_SQL) {
            $errorMessage = \sprintf(
                'FATAL ERROR (%s): Query was empty.',
                $this->currentLink->errno
            );
        } elseif ($errorType == self::E_ENGINE_ERROR) {
            $errorMessage = \sprintf(
                'FATAL ERROR (%s): %s: %s',
                $this->currentLink->errno,
                $this->currentLink->error,
                $this->currentQuery
            );
        }

        if ($this->logHandler !== null) {
            $this->logHandler->logError($errorMessage, $className);
        }

        if ($this->errorLevel == 'print') {
            $errorText = \sprintf('%s%s%s%s', $errorMessage, Tags::CRLF, Tags::br(), Tags::CRLF);
            echo filter_var($errorText, FILTER_DEFAULT);
        }
        if ($this->errorLevel == 'exception') {
            $this->closeConnection();
            throw new RuntimeException($errorMessage);
        }
    }
protected function setError(int $errorType = 0, string $className = ''): void
    {
        $errorMessage = '';
        if ($errorType == self::E_NO_CONNECTION) {
            $errorMessage = \sprintf(
                'FATAL ERROR (%s): Cannot establish connection to database server.',
                $this->currentLink->connect_errno
            );
        } elseif ($errorType == self::E_NO_DB_SELECTED) {
            $errorMessage = \sprintf(
                'FATAL ERROR (%s): Cannot select database \'%s\'.',
                $this->currentLink->errno,
                $this->selectedDB
            );
        } elseif ($errorType == self::E_NO_SQL) {
            $errorMessage = \sprintf(
                'FATAL ERROR (%s): Query was empty.',
                $this->currentLink->errno
            );
        } elseif ($errorType == self::E_ENGINE_ERROR) {
            $errorMessage = \sprintf(
                'FATAL ERROR (%s): %s: %s',
                $this->currentLink->errno,
                $this->currentLink->error,
                $this->currentQuery
            );
        }

        if ($this->logHandler !== null) {
            $this->logHandler->logError($errorMessage, $className);
        }

        if ($this->errorLevel == 'print') {
            $errorText = \sprintf('%s%s%s%s', $errorMessage, Tags::CRLF, Tags::br(), Tags::CRLF);
            echo filter_var($errorText, FILTER_DEFAULT);
        }
        if ($this->errorLevel == 'exception') {
            $this->closeConnection();
            throw new RuntimeException($errorMessage);
        }
    }
protected function setError ( int $ errorType = 0 , string $ className = '' ) : void { $ errorMessage = '' ; if ( $ errorType == self :: E_NO_CONNECTION ) { $ errorMessage = \ sprintf ( 'FATAL ERROR (%s): Cannot establish connection to database server.' , $ this -> currentLink -> connect_errno ) ; } elseif ( $ errorType == self :: E_NO_DB_SELECTED ) { $ errorMessage = \ sprintf ( 'FATAL ERROR (%s): Cannot select database \'%s\'.' , $ this -> currentLink -> errno , $ this -> selectedDB ) ; } elseif ( $ errorType == self :: E_NO_SQL ) { $ errorMessage = \ sprintf ( 'FATAL ERROR (%s): Query was empty.' , $ this -> currentLink -> errno ) ; } elseif ( $ errorType == self :: E_ENGINE_ERROR ) { $ errorMessage = \ sprintf ( 'FATAL ERROR (%s): %s: %s' , $ this -> currentLink -> errno , $ this -> currentLink -> error , $ this -> currentQuery ) ; } if ( $ this -> logHandler !== null ) { $ this -> logHandler -> logError ( $ errorMessage , $ className ) ; } if ( $ this -> errorLevel == 'print' ) { $ errorText = \ sprintf ( '%s%s%s%s' , $ errorMessage , Tags :: CRLF , Tags :: br ( ) , Tags :: CRLF ) ; echo filter_var ( $ errorText , FILTER_DEFAULT ) ; } if ( $ this -> errorLevel == 'exception' ) { $ this -> closeConnection ( ) ; throw new RuntimeException ( $ errorMessage ) ; } }
Handles class errors.

@param int    $errorType
@param string $className
Handles class errors .