szurubooru/src/Views/error-exception.phtml
2013-10-05 13:15:48 +02:00

72 lines
1.3 KiB
PHTML

<?php
echo '<h1>Unhandled exception</h1>';
echo '<p>';
printf('%s &bdquo;%s&rdquo; thrown at %s:%d',
get_class($this->context->exception),
$this->context->exception->getMessage(),
$this->context->exception->getFile(),
$this->context->exception->getLine());
echo '</p>';
echo '<ul>';
$count = 0;
foreach ($this->context->exception->getTrace() as $frame)
{
$args = '';
if (isset($frame['args']))
{
$args = array();
foreach ($frame['args'] as $arg)
{
if (is_string($arg))
{
$args[] = "'" . $arg . "'";
}
elseif (is_array($arg))
{
$args[] = "Array";
}
elseif (is_null($arg))
{
$args[] = 'NULL';
}
elseif (is_bool($arg))
{
$args[] = ($arg) ? "true" : "false";
}
elseif (is_object($arg))
{
$args[] = get_class($arg);
}
elseif (is_resource($arg))
{
$args[] = get_resource_type($arg);
}
else
{
$args[] = $arg;
}
}
$args = join(', ', $args);
}
echo '<li>';
printf('#%s %s(%s): %s(%s)<br>',
$count,
isset($frame['file'])
? $frame['file']
: 'unknown file',
isset($frame['line'])
? $frame['line']
: 'unknown line',
isset($frame['class'])
? $frame['class'] . $frame['type'] . $frame['function']
: $frame['function'],
$args);
echo '</li>';
$count++;
}
echo '</ul>';