Optionally raises an error and pushes the error on the error cache

@param string $msg  Errortext
@param int    $line Line in the LDIF that caused the error

@access protected
@return void
763725
protected function dropError($msg, $line = null)
    {
        $this->_error['error'] = new Net_LDAP2_Error($msg);
        if ($line !== null) $this->_error['line'] = $line;

        if ($this->_options['onerror'] == 'die') {
            die($msg.PHP_EOL);
        } elseif ($this->_options['onerror'] == 'warn') {
            echo $msg.PHP_EOL;
        }
    }
137803
protected function SetError($msg) {
    $this->error_count++;
    if (($this->Mailer == 'smtp') and ($this->smtp !== null)) {
      $lasterror = $this->smtp->getError();
      if (!empty($lasterror) and array_key_exists('smtp_msg', $lasterror)) {
        $msg .= '<p>' . $this->Lang('smtp_error') . $lasterror['smtp_msg'] . "</p>\n";
      }
    }
    $this->ErrorInfo = $msg;
  }
1272711
public static function errorHandler($code, $message, $file, $line)
    {

        if (error_reporting() === 0) {
            // This error code is not included in error_reporting
            return false;
        }
        throw new \sb\Exception($code, $message, $file, $line);
    }
248700
public function logError($error, $msg = '')
    {
        if (is_object($error)) {
            // we got exception object obviously
            $error = $error->getMessage();
        }
        $this->app->getLogger()->logLine($msg.' '.$error."\n", null, 'error');
    }
947148
public function showError($msg=null)
    {
        if (is_null($msg)) $msg = $this->getErrorMessage();
        throw new Exception($msg);
    }
878005
final public function logError($msg_code,$data = array())
    {
        self::write(self::compileMessage(self::$error_msg[$msg_code],$data), PEL_ERROR);
    }
763554
public static function errorToException($code, $message, $file, $line)
    {
        if (error_reporting() & $code) {
            throw new \ErrorException($message, 0, $code, $file, $line);
        }
    }
53524
public function err($msg)
    {
        if (!empty($this->controller->Flash)) {
            $this->controller->Flash->error($msg);
        } else {
            $this->Shell->err($msg);
        }
    }
1044945
protected function error( $text, $pos = null ) {
		if ( !$this->ignoreErrors ) {
			if ( $pos === null ) {
				$pos = $this->pos;
			}
			$this->listener->error( $text, $pos );
		}
	}
1224883
public function error($msg, Token $token = null, $code = 0)
    {
        $error = new ParserException(
            Translator::gettext($msg),
            $token,
            $code
        );
        parent::error($error);
    }
914104
public function handleError($level, $message, $file, $line)
    {
        if (error_reporting() & $level) {
            $exception_level = isset($this->levels[$level]) ? $this->levels[$level] : $level;

            throw new \ErrorException(
                sprintf('%s: %s in %s line %d', $exception_level, $message, $file, $line),
                0,
                $level,
                $file,
                $line
            );
        }
    }
1140322
public function error(string $message, array $context = []){
        if($this->logger !== null){
            $this->logger->error($message, $context);
        }

        if($this->messagePanel !== null){
            $this->messagePanel->addMessage($message, LogLevel::ERROR);
        }
    }
71866
public function setError($msg, Exception $cause = null)
    {
        if ($this->errmsg === null) {
            $this->errmsg = $msg;
            $this->cause = $cause;
        }
    }
559646
public static function handleError($code, $message, $file, $line)
    {
        $list = static::getSystemError($code);
        $name = $list[0];
        $type = $list[1];

        $message = "\"$message\" in $file:$line";

        switch ($type)
        {
            case static::E_NOTICE:  throw new NoticeError($message);
            case static::E_WARNING: throw new WarningError($message);
            case static::E_ERROR:   throw new FatalError($message);
            default:                return;
        }
    }
883535
public function errorHandler(int $type, string $message, string $file, int $line) :void
    {
        $this->whichError($message, $type, $file, $line);
    }
600471
public function throwError($msg = null) {
if ($this->sourceLoc >= 0) {
$this->sourceParser->throwError($msg, $this->sourceLoc);
}
throw new \Exception($msg);
}
872498
public function errTrigger( $msg, $context, $level = E_WARNING ) {
		$die = false;
		$error = false;
		$notice = false;
		// Create $code string, decide error/die behaviour
		// and cast to USER constant as required by trigger_error().
		switch ( $level ) {
			// Fatal
			case E_ERROR:
			case E_USER_ERROR:
				$level = E_USER_ERROR;
				$code = 'Fatal error';
				$error = true;
				$die = true;
				break;

			// Warning
			case E_WARNING:
			case E_USER_WARNING:
				$level = E_USER_WARNING;
				$code = 'Warning';
				$error = true;
				break;

			// Notice
			case E_NOTICE:
			case E_USER_NOTICE:
				$level = E_USER_NOTICE;
				$code = 'Notice';
				$notice = true;
				break;

			// Unknown
			default:
				$code = 'Unknown error';
		}

		if ( $error && $this->suppressfatal ) {
			return;
		}
		if ( $notice && $this->suppressnotice ) {
			return;
		}

		$errorMsg = "$code: [$context] $msg";

		trigger_error( $errorMsg, $level );

		if ( $die && !$this->stayalive ) {
			die;
		}
	}