mirror of
https://github.com/filp/whoops.git
synced 2026-08-31 04:27:52 +00:00
Merge pull request #445 from filp/plain-text-in-pretty-page
Plain text in pretty page
This commit is contained in:
@@ -128,6 +128,22 @@ class PlainTextHandler extends Handler
|
||||
$this->traceFunctionArgsOutputLimit = (integer) $traceFunctionArgsOutputLimit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create plain text response and return it as a string
|
||||
* @return string
|
||||
*/
|
||||
public function generateResponse()
|
||||
{
|
||||
$exception = $this->getException();
|
||||
return sprintf("%s: %s in file %s on line %d%s\n",
|
||||
get_class($exception),
|
||||
$exception->getMessage(),
|
||||
$exception->getFile(),
|
||||
$exception->getLine(),
|
||||
$this->getTraceOutput()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the size limit in bytes of frame arguments var_dump output.
|
||||
* If the limit is reached, the var_dump output is discarded.
|
||||
@@ -240,15 +256,7 @@ class PlainTextHandler extends Handler
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$exception = $this->getException();
|
||||
|
||||
$response = sprintf("%s: %s in file %s on line %d%s\n",
|
||||
get_class($exception),
|
||||
$exception->getMessage(),
|
||||
$exception->getFile(),
|
||||
$exception->getLine(),
|
||||
$this->getTraceOutput()
|
||||
);
|
||||
$response = $this->generateResponse();
|
||||
|
||||
if ($this->getLogger()) {
|
||||
$this->getLogger()->error($response);
|
||||
|
||||
@@ -210,6 +210,11 @@ class PrettyPageHandler extends Handler
|
||||
header('Content-Type: text/html');
|
||||
}
|
||||
|
||||
$plainTextHandler = new PlainTextHandler();
|
||||
$plainTextHandler->setException($this->getException());
|
||||
$plainTextHandler->setInspector($this->getInspector());
|
||||
$vars["preface"] = "<!--\n\n\n" . $plainTextHandler->generateResponse() . "\n\n\n\n\n\n\n\n\n\n\n-->";
|
||||
|
||||
$helper->setVariables($vars);
|
||||
$helper->render($templateFile);
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Layout template file for Whoops's pretty error output.
|
||||
*/
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<!DOCTYPE html><?php echo $preface; ?>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
Reference in New Issue
Block a user