Displays an error.

@param \Throwable $throwable
@param int        $code
@param string     $text
968343
public static function showError(\Throwable $throwable, int $code = 500, $text = 'Internal Server Error')
    {
        if (Config::application('debug')) {
            /* @noinspection PhpUnusedLocalVariableInspection variable uses in 500.php */
            $error = Html::e($throwable);
        }

        header("HTTP/1.1 $code $text");

        $file = $code . '.php';
        $path = __DIR__ . '/../../../../../../application/views/error/';

        /** @noinspection PhpIncludeInspection */
        include file_exists($path . $file) ? $path . $file : __DIR__ . '/views/' . $file;
    }
1030288
protected function writeToErrorLog($throwable)
    {
        if ($this->displayErrorDetails) {
            return;
        }

        $message = 'Slim Application Error:' . PHP_EOL;
        $message .= $this->renderThrowableAsText($throwable);
        while ($throwable = $throwable->getPrevious()) {
            $message .= PHP_EOL . 'Previous error:' . PHP_EOL;
            $message .= $this->renderThrowableAsText($throwable);
        }

        $message .= PHP_EOL . 'View in rendered output by enabling the "displayErrorDetails" setting.' . PHP_EOL;

        $this->logError($message);
    }
1217037
public function throwError($string, $code = 500, $e = null)
    {
        if (!$this->isFullException() || is_null($e)) {
            throw new \Exception($string, $code);
        } else {
            throw new \Exception($string . ": " . $e->getMessage(), $code);
        }
    }
1082792
public function errorHandler($code, $message, $file, $line)
    {
        switch ($code) {
            case E_NOTICE:
            case E_USER_NOTICE:
                $exception = new Errors\Notice($message, $code, 1, $file, $line);
                break;
            case E_WARNING:
            case E_USER_WARNING:
                $exception = new Errors\Warning($message, $code, 1, $file, $line);
                break;
            case E_ERROR:
            case E_CORE_ERROR:
            case E_RECOVERABLE_ERROR:
            case E_USER_ERROR:
                $exception = new Errors\Fatal($message, $code, 1, $file, $line);
                break;
            default:
                $exception = new Errors\Error($message, $code, 1, $file, $line);
                break;
        }

        $this->exceptionHandler($exception);

        if ($this->oldErrorHandler) {
            return call_user_func(
                $this->oldErrorHandler,
                $code,
                $message,
                $file,
                $line
            );
        }

        return false;
    }
1235434
function onUncaughtException(\Throwable $exception): void
    {
        try {
            // handle the exception
            try {
                $this->emit(ErrorHandlerEvents::EXCEPTION, $exception, $this->debug);
            } catch (\Throwable $e) {
                $exception = new ChainedException(
                    'Additional exception was thrown from an [exception] event listener. See previous exceptions.',
                    0,
                    Exception::joinChains($exception, $e)
                );
            }

            $this->invokeErrorScreen($exception);

            return;
        } catch (\Throwable $e) {
            $exception = new ChainedException(
                sprintf('Additional exception was thrown while trying to invoke %s. See previous exceptions.', get_class($this->errorScreen)),
                0,
                Exception::joinChains($exception, $e)
            );

            $this->emit(ErrorHandlerEvents::FAILURE, $exception, $this->debug);
        }

        // unhandled exception
        if ($this->debug && $this->printUnhandledExceptionInDebug) {
            echo Exception::render($exception, true, true);
        }
    }
1136063
protected function throwException($code, $msg)
    {
        $args = func_get_args();

        $code = array_shift($args);

        throw new \RuntimeException(call_user_func_array('sprintf', $args), $code);
    }
416449
protected function _error($text, $error, $e_code)
    {
        /* Split the SMTP response into a code and a response string. */
        list($code, $response) = $this->_smtp->getResponse();

        /* Abort current SMTP transaction. */
        $this->_smtp->rset();

        /* Build our standardized error string. */
        throw new Horde_Mail_Exception($text . ' [SMTP: ' . $error->getMessage() . " (code: $code, response: $response)]", $e_code);
    }
5901
public function throwError($number, $text = false, $exit = true)
    {
        if ($this->_catchAllErrors || in_array($number, $this->_skipErrorsArray)) {
            return false;
        }

        switch ($number)
        {
            case CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST:
            case CKFINDER_CONNECTOR_ERROR_INVALID_NAME:
            case CKFINDER_CONNECTOR_ERROR_THUMBNAILS_DISABLED:
            case CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED:
                header("HTTP/1.0 403 Forbidden");
                header("X-CKFinder-Error: ". $number);
                break;

            case CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED:
                header("HTTP/1.0 500 Internal Server Error");
                header("X-CKFinder-Error: ".$number);
                break;

            default:
                header("HTTP/1.0 404 Not Found");
                header("X-CKFinder-Error: ". $number);
                break;
        }

        if ($exit) {
            exit;
        }
    }
942788
public function newException(string $code, $value): Exception
    {
        $exception = $this->getException($code);

        return new $exception(
            strtoupper(Str::kebab($this->getManager()->getName())),
            strtoupper(Str::kebab($this->getName())),
            $value
        );
    }
560236
public static function throw(string $message, int $code = 1, string $type = '', string $secondMessage = '') {
        throw new static($message, $code, $type, $secondMessage);
    }
964101
private static void throwFault(String code, String message, Throwable t) throws PutEventsFault {
        if (LOG.isLoggable(Level.SEVERE)) {
            LOG.log(Level.SEVERE, "Throw Fault " + code + " " + message, t);
        }

        FaultType faultType = new FaultType();
        faultType.setFaultCode(code);
        faultType.setFaultMessage(message);

        StringWriter stringWriter = new StringWriter();
        PrintWriter printWriter = new PrintWriter(stringWriter);

        t.printStackTrace(printWriter);

        faultType.setStackTrace(stringWriter.toString());

        throw new PutEventsFault(message, faultType, t);
    }
4308
public function throwException(
        $message,
        $code,
        $connectionErrorNumber = null,
        $httpStatusCode = null,
        $previousException = null
    ) {
        throw new PhpCapException(
            $message,
            $code,
            $connectionErrorNumber,
            $httpStatusCode,
            $previousException
        );
    }
81138
function error($code,$text='',array $trace=NULL) {
		$prior=$this->hive['ERROR'];
		$header=$this->status($code);
		$req=$this->hive['VERB'].' '.$this->hive['PATH'];
		if (!$text)
			$text='HTTP '.$code.' ('.$req.')';
		$logger = new Log($this->hive['ERROR_LOG']);
		$logger->write($text);
		$trace=$this->trace($trace);
		foreach (explode("\n",$trace) as $nexus)
			if ($nexus)
				$logger->write($nexus);
		unset($logger);
		if ($highlight=PHP_SAPI!='cli' && !$this->hive['AJAX'] &&
			$this->hive['HIGHLIGHT'] && is_file($css=$this->hive['ERROR_TEMPLATE']['CSS']))
			$trace=$this->highlight($trace);
		$this->hive['ERROR']=array(
			'status'=>$header,
			'code'=>$code,
			'text'=>$text,
			'trace'=>$trace
		);
		$handler=$this->hive['ONERROR'];
		$this->hive['ONERROR']=NULL;
		if ((!$handler ||
			$this->call($handler,array($this,$this->hive['PARAMS']),
				'beforeroute,afterroute')===FALSE) &&
			!$prior && PHP_SAPI!='cli' && !$this->hive['QUIET'])
            if ($this->hive['AJAX']) {
                echo json_encode($this->hive['ERROR']);
            } else {
                $views = $this->hive['ERROR_TEMPLATE'];
                isset($views['FALLBACK']) || user_error(self::E_fallback);
                $view = isset($views['E'.$code])?$views['E'.$code]:$views['FALLBACK'];
                $this->set('ASSETS.error.code', ($highlight?($this->read($css)):''));
                !(is_file($css=$this->hive['ERROR_TEMPLATE']['CSS_LAYOUT'])) ||
                	$this->set('ASSETS.error.layout', $this->read($css));
                $this->concat('UI', ';'.$this->fixslashes(__DIR__).'/');
                echo Silet::instance()->render($view);
            }
		if ($this->hive['HALT'])
			die;
	}
278041
public function handleError($error, $code, $path, $source, $parameters, $options)
    {
        /* @var \Throwable $error */
        $exception = $options['debug']
            ? $this->getDebuggedException($error, $code, $source, $path, $parameters, $options)
            : $error;

        $handler = $options['error_handler'];
        if (!$handler) {
            // @codeCoverageIgnoreStart
            if ($options['debug'] && $options['exit_on_error']) {
                if ($options['html_error']) {
                    echo $exception->getMessage();
                    exit(1);
                }
                if (!function_exists('xdebug_is_enabled') || !xdebug_is_enabled()) {
                    echo $exception->getMessage()."\n".$exception->getTraceAsString();
                    exit(1);
                }
            }
            // @codeCoverageIgnoreEnd
            throw $exception;
        }

        $handler($exception);
    }
786007
public static function errorHandlerCallback($code, $string, $file, $line, $context)
    {
        $e = new self($string, $code);
        $e->line = $line;
        $e->file = $file;
        throw $e;
    }
923996
private function createThrowableHtmlResponse(
        Throwable $throwable,
        string $text,
        int $status
    ): ThrowableResponseInterface {
        return new class ($throwable, $text, $status) extends HtmlResponse implements ThrowableResponseInterface
        {
            use ThrowableResponseTrait;

            /**
             * @param Throwable $throwable
             * @param string    $text
             * @param int       $status
             */
            public function __construct(Throwable $throwable, string $text, int $status)
            {
                parent::__construct($text, $status);
                $this->setThrowable($throwable);
            }
        };
    }
438134
private static function __triggerError($message, $file, $line, $code = 0)
        {
            if (self::$useExceptions) {
                throw new Exception($message, $file, $line, $code);
            } else {
                trigger_error($message, E_USER_WARNING);
            }
        }