Returns Description of HTML Document or throws Exception.
@access		public
@param		bool			$throwException		Flag: throw Exception if not found, otherwise return empty String
@return		string
@throws		RuntimeException
515858
public function getDescription( $throwException = TRUE )
	{
		$tags	= $this->getMetaTags( TRUE );
		if( isset( $tags['description'] ) )
			return $tags['description'];
		if( isset( $tags['dc.description'] ) )
			return $tags['dc.description'];
		if( $throwException )
			throw new RuntimeException( 'No Description Meta Tag set.' );
		return "";
	}
1054347
public function render($exception)
    {
        if ($exception instanceof HTTPException) {
            return new Response($exception->getCode(), [], $exception->getMessage());
        }

        return null;
    }
131728
function _exceptionHandler($exception)
    {
        $result['message'] = $exception->getMessage();

        if (self::$_config['errors']['exceptionBacktrace']) {
            $result['backtrace'] = $this->convertTrace($exception->getTrace());
        }

        $result['string'] = $exception->getTraceAsString();
        $result['code']   = $exception->getCode();

        if ($this->_isLiteMode()) {
            $this->_dumpRenderLite(PHP_EOL . $result['string'], '** EXCEPTION / ' . $this->_htmlChars($result['message']));

        } else {
            $this->_initAssets(true);
            $this->dump($result, '<b style="color:red;">**</b> EXCEPTION / ' . $this->_htmlChars($result['message']));
        }

        return true;
    }
624753
protected function getItemHtmlMessage($exception)
    {
        $html = sprintf('<div><strong>Type:</strong> %s</div>', get_class($exception));
        
        if (($code = $exception->getCode())) {
            $html .= sprintf('<div><strong>Code:</strong> %s</div>', $code);
        }
        
        if (($message = $exception->getMessage())) {
            $html .= sprintf('<div><strong>Message:</strong> %s</div>', htmlentities($message));
        }
        
        if (($file = $exception->getFile())) {
            $html .= sprintf('<div><strong>File:</strong> %s</div>', $file);
        }
        
        if (($line = $exception->getLine())) {
            $html .= sprintf('<div><strong>Line:</strong> %s</div>', $line);
        }
        
        if (($trace = $exception->getTraceAsString())) {
            $html .= '<h2>Trace</h2>';
            $html .= sprintf('<pre>%s</pre>', htmlentities($trace));
        }
        
        return $html;
    }
230260
static function getName(\Throwable $exception): string
    {
        $name = null;

        if ($exception instanceof \ErrorException) {
            $name = Error::getName($exception->getSeverity());
        }

        if ($name === null) {
            $name = get_class($exception);
        }

        if (($code = $exception->getCode()) !== 0) {
            $name .= " ({$code})";
        }

        return $name;
    }
391707
public function display()
    {
        // hide path root and stip tags from exception message
        $msg = Str::replace(root, '$DOCUMENT_ROOT', $this->getMessage());
        $msg = App::$Security->strip_tags($msg);
        // get message translation
        $this->text = App::$Translate->get('Default', $this->text, ['e' => $msg]);
        
        // if exception is throwed not from html-based environment
        if (env_type !== 'html') {
            if (env_type === 'json') {
                return (new JsonException($msg))->display();
            } else {
                return $this->text;
            }
        }
        
        // add notification in debug bar if exist
        if (App::$Debug !== null) {
            App::$Debug->addException($this);
        }

        // return rendered result
        return $this->buildFakePage();
    }
284015
public function get($url) {
		$reporting = error_reporting(0);
		$context = $this->_createContext();
		$contents = file_get_contents($url, false, $context);
		error_reporting($reporting);

		if ($contents === false) {
			$code = isset($http_response_header[0])
				? $this->_extractHttpCode($http_response_header[0])
				: $this->_defaultCode;

			throw new Exception($url, $code);
		}

		return $contents;
	}
1190495
public function getHtml(){
		if( !$this->response )
			throw new RuntimeException( 'No conversion started' );
		$cacheKey	= 'premailer_'.$this->response->requestId.'.html';
		if( $this->cache && $this->cache->has( $cacheKey ) )
			return $this->cache->get( $cacheKey );
		$html	= Net_Reader::readUrl( $this->response->documents->html );
		$this->cache && $this->cache->set( $cacheKey, $html );
		return $html;
	}
626635
protected function renderHtmlExceptionOrError($exception)
    {
        if (!$exception instanceof Exception && !$exception instanceof \Error) {
            throw new RuntimeException("Unexpected type. Expected Exception or Error.");
        }

        $html = sprintf('<div><strong>Type:</strong> %s</div>', get_class($exception));

        if (($code = $exception->getCode())) {
            $html .= sprintf('<div><strong>Code:</strong> %s</div>', $code);
        }

        if (($message = $exception->getMessage())) {
            $html .= sprintf('<div><strong>Message:</strong> %s</div>', htmlentities($message));
        }

        if (($file = $exception->getFile())) {
            $html .= sprintf('<div><strong>File:</strong> %s</div>', $file);
        }

        if (($line = $exception->getLine())) {
            $html .= sprintf('<div><strong>Line:</strong> %s</div>', $line);
        }

        if (($trace = $exception->getTraceAsString())) {
            $html .= '<h2>Trace</h2>';
            $html .= sprintf('<pre>%s</pre>', htmlentities($trace));
        }

        return $html;
    }
959135
private function getExceptionFromResult(Pjb62\Exception\JavaException $result): Exception\JavaExceptionInterface
    {
        $found = false;
        $exceptionClass = '';

        $message = $result->__get('message')->__toString();

        foreach ($this->msgPatternsMapping as $exceptionClass => $pattern) {
            if (preg_match($pattern, $message)) {
                $found = true;
                break;
            }
        }

        if (!$found) {
            $exceptionClass = $this->defaultException;
        }

        $cls = '\\Soluble\\Japha\\Bridge\\Exception\\'.$exceptionClass;

        // Public message, mask any login/passwords
        $message = preg_replace('/user=([^&\ ]+)|password=([^&\ ]+)/', '****', $message);
        $stackTrace = $result->getCause()->__toString();
        $code = $result->getCode();

        $driverException = null;
        if ($result instanceof \Exception) {
            $driverException = $result;
        }

        // Getting original class name from cause
        preg_match('/Cause: ([^:]+):/', $message, $matches);
        if (count($matches) > 1) {
            $javaExceptionClass = $matches[1];
        } else {
            $javaExceptionClass = 'unkwown';
        }

        // Getting cause from message
        $tmp = explode('Cause: ', $message);
        if (count($tmp) > 1) {
            array_shift($tmp);
            $cause = trim(implode(', ', $tmp));
        } else {
            $cause = $message;
        }
        $e = new $cls(
            $message,
            $cause,
            $stackTrace,
            $javaExceptionClass,
            $code,
            $driverException,
            null
        );

        $this->logException($e, $exceptionClass);

        return $e;
    }
1206634
protected function createResponseBody(\Throwable $exception): string
    {
        if (file_exists($this->projectPath . '/docroot/500.html')) {
            return file_get_contents($this->projectPath . '/docroot/500.html');
        }

        return "I'm sorry but I can not fulfill your request. Somewhere someone messed something up.";
    }
185893
public function getHtml($exception)
    {
        if (!$exception instanceof FlattenException) {
            $exception = FlattenException::create($exception);
        }

        return $this->decorate($this->getContent($exception), $this->getStylesheet($exception));
    }
925908
static function render(\Throwable $exception, bool $renderTrace = true, bool $renderPrevious = false): string
    {
        $exceptions = $renderPrevious ? static::getChain($exception) : [$exception];
        $totalExceptions = count($exceptions);
        $lastException = $totalExceptions - 1;

        $output = '';
        for ($i = 0; $i < $totalExceptions; ++$i) {
            if ($i > 0 && $renderTrace) {
                $output .= "\n";
            }

            $output .= ($renderPrevious ? '[' . ($i + 1) . "/{$totalExceptions}] " : '')
                . static::getName($exceptions[$i])
                . ': ' . ($exceptions[$i]->getMessage() ?: '<no message>')
                . " in {$exceptions[$i]->getFile()} on line {$exceptions[$i]->getLine()}";

            if ($renderTrace || $i < $lastException) {
                $output .= "\n";
            }

            if ($renderTrace) {
                $output .= $exceptions[$i]->getTraceAsString();

                if ($i < $lastException) {
                    $output .= "\n";
                }
            }
        }

        return $output;
    }
413794
public function getLanguage( $throwException = TRUE )
	{
		$tags	= $this->getMetaTags( TRUE );
		if( isset( $tags['content-language'] ) )
			return $tags['content-language'];
		if( $throwException )
			throw new RuntimeException( 'No Language Meta Tag set.' );
		return "";
	}
539612
protected function _get(\Throwable $e)
	{
		$path_to_root = $_SERVER['DOCUMENT_ROOT'];

		$rows = array();
		
		// first row : current script with error line
		$rows[] = [
				// file		
				str_replace($path_to_root . '/', '', $e->getFile()),
			
				// line
				$e->getLine(),
			
				// function
				"throw new " . get_class($e),
			
				// function parameters
				""
			];
		

		
		// for each call stack element
		foreach ( $e->getTrace() as $trace )
		{
			$rows[] = [
					
					// file
					str_replace($path_to_root . '/', '', $trace['file']),
				
					// line
					$trace['line'],
				
					// function
					$trace['class'] ? ($trace['class'] . '::' . $trace['function']) : $trace['function'],
				
					// args
					print_r($trace['args'], true)
				];
		}
		
		
		return $rows;
	}
564884
protected function getBody(Throwable $exception): string
	{
		if($this->returnAsJson())
		{
			$this->response->setType('application/json');

			return $this->getExceptionAsJson($exception);
		}

		if($this->returnAsXml())
		{
			$this->response->setType('application/xml');

			return $this->getExceptionAsXml($exception);
		}

		$this->response->setType('text/html');

		return $this->getExceptionAsRenderedView($exception);
	}
41710
public function toString($format = 'text', $relativeDir = NULL, $relativeDirLabel = NULL) {
    return self::getExceptionText($this, $format, $relativeDir, $relativeDirLabel);
  }