Commit c18e4331 authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

Amélioration des vues affichant les erreurs

parent 1c404712
Pipeline #5431 failed with stage
in 9 seconds
<?php $this->headTitle()->append($title = $this->translate('A 404 error occurred')) ?>
<?php
use Zend\Mvc\Application;
?>
<h1>A 404 error occurred</h1>
<h2><?= $this->message ?></h2>
<div class="jumbotron">
<h1><?php echo $title ?></h1>
<h2 class="text-danger"><?php echo $this->translate($this->message) ?></h2>
<?php if (isset($this->reason) && $this->reason): ?>
<?php
$reasonMessage= '';
<?php if (! empty($this->reason)) :
switch ($this->reason) {
case 'error-controller-cannot-dispatch':
$reasonMessage = $this->translate('The requested controller was unable to dispatch the request.');
case Application::ERROR_CONTROLLER_CANNOT_DISPATCH:
$reasonMessage = 'The requested controller was unable to dispatch the request.';
break;
case 'error-controller-not-found':
$reasonMessage = $this->translate('The requested controller could not be mapped to an existing controller class.');
case Application::ERROR_MIDDLEWARE_CANNOT_DISPATCH:
$reasonMessage = 'The requested middleware was unable to dispatch the request.';
break;
case 'error-controller-invalid':
$reasonMessage = $this->translate('The requested controller was not dispatchable.');
case Application::ERROR_CONTROLLER_NOT_FOUND:
$reasonMessage = 'The requested controller could not be mapped to an existing controller class.';
break;
case 'error-router-no-match':
$reasonMessage = $this->translate('The requested URL could not be matched by routing.');
case Application::ERROR_CONTROLLER_INVALID:
$reasonMessage = 'The requested controller was not dispatchable.';
break;
case Application::ERROR_ROUTER_NO_MATCH:
$reasonMessage = 'The requested URL could not be matched by routing.';
break;
default:
$reasonMessage = $this->translate('We cannot determine at this time why a 404 was generated.');
$reasonMessage = 'We cannot determine at this time why a 404 was generated.';
break;
}
?>
<p><?= $reasonMessage ?></p>
<?php endif ?>
<p><?php echo $reasonMessage ?></p>
<?php endif ?>
<?php if (isset($this->controller) && $this->controller): ?>
<?php if (! empty($this->controller)) : ?>
<dl>
<dt><?php echo $this->translate('Controller') ?>:</dt>
<dd><?php echo $this->escapeHtml($this->controller) ?>
<?php
if (isset($this->controller_class)
&& $this->controller_class
&& $this->controller_class != $this->controller
) {
echo '(' . sprintf($this->translate('resolves to %s'), $this->escapeHtml($this->controller_class)) . ')';
}
?>
</dd>
<dt>Controller:</dt>
<dd>
<?= $this->escapeHtml($this->controller) ?>
<?php
if (! empty($this->controller_class) && $this->controller_class != $this->controller) {
printf('(resolves to %s)', $this->escapeHtml($this->controller_class));
}
?>
</dd>
</dl>
<?php endif ?>
<?php endif ?>
<?php if (isset($this->exception) && $this->exception): ?>
<?php if (! empty($this->display_exceptions)) : ?>
<?php if (isset($this->exception)
&& ($this->exception instanceof \Exception || $this->exception instanceof \Error)) : ?>
<hr/>
<h2><?php echo $this->translate('Exception') ?>:</h2>
<h2>Additional information:</h2>
<h3><?= get_class($this->exception) ?></h3>
<dl>
<dt>File:</dt>
<dd>
<pre><?= $this->exception->getFile() ?>:<?= $this->exception->getLine() ?></pre>
</dd>
<dt>Message:</dt>
<dd>
<pre><?= $this->escapeHtml($this->exception->getMessage()) ?></pre>
</dd>
<dt>Stack trace:</dt>
<dd>
<pre><?= $this->escapeHtml($this->exception->getTraceAsString()) ?></pre>
</dd>
</dl>
<p><b><?php echo $this->escapeHtml($this->exception->getMessage()) ?></b></p>
<h3><?php echo $this->translate('Stack trace') ?>:</h3>
<pre>
<?php echo \UnicaenApp\Util::formatTraceString($this->exception->getTraceAsString()) ?>
</pre>
<?php if ($ex = $this->exception->getPrevious()) : ?>
<hr/>
<h2>Previous exceptions:</h2>
<ul class="list-unstyled">
<?php $icount = 0 ?>
<?php while ($ex) : ?>
<li>
<h3><?= get_class($ex) ?></h3>
<dl>
<dt>File:</dt>
<dd>
<pre><?= $ex->getFile() ?>:<?= $ex->getLine() ?></pre>
</dd>
<dt>Message:</dt>
<dd>
<pre><?= $this->escapeHtml($ex->getMessage()) ?></pre>
</dd>
<dt>Stack trace:</dt>
<dd>
<pre><?= $this->escapeHtml($ex->getTraceAsString()) ?></pre>
</dd>
</dl>
</li>
<?php
$ex = $ex->getPrevious();
if (++$icount >= 50) {
echo '<li>There may be more exceptions, but we do not have enough memory to process it.</li>';
break;
}
?>
<?php endwhile ?>
</ul>
<?php endif ?>
<?php else : ?>
<h3>No Exception available</h3>
<?php endif ?>
</div>
\ No newline at end of file
<?php endif ?>
......@@ -5,60 +5,60 @@
<?php if (isset($this->display_exceptions) && $this->display_exceptions): ?>
<?php if(isset($this->exception) && ($this->exception instanceof Exception || $this->exception instanceof Error)): ?>
<hr/>
<h2><?php echo $this->translate('Additional information') ?>:</h2>
<h3><?php echo get_class($this->exception); ?></h3>
<dl>
<dt><?php echo $this->translate('File') ?>:</dt>
<dd>
<pre class="prettyprint linenums"><?php echo $this->exception->getFile() ?>:<?php echo $this->exception->getLine() ?></pre>
</dd>
<dt><?php echo $this->translate('Message') ?>:</dt>
<dd>
<pre class="prettyprint linenums"><?php echo $this->exception->getMessage() ?></pre>
</dd>
<dt><?php echo $this->translate('Stack trace') ?>:</dt>
<dd>
<pre class="prettyprint linenums"><?php echo \UnicaenApp\Util::formatTraceString($this->exception->getTraceAsString()) ?></pre>
</dd>
</dl>
<?php
$e = $this->exception->getPrevious();
if ($e) :
?>
<hr/>
<h2><?php echo $this->translate('Previous exceptions') ?>:</h2>
<ul class="unstyled">
<?php while($e) : ?>
<li>
<h3><?php echo get_class($e); ?></h3>
<?php if (isset($this->exception) && $this->exception instanceof Exception || $this->exception instanceof Error): ?>
<hr/>
<h2><?php echo $this->translate('Additional information') ?>:</h2>
<h3><?php echo get_class($this->exception); ?></h3>
<dl>
<dt><?php echo $this->translate('File') ?>:</dt>
<dd>
<pre class="prettyprint linenums"><?php echo $e->getFile() ?>:<?php echo $e->getLine() ?></pre>
<pre class="prettyprint linenums"><?php echo $this->exception->getFile() ?>:<?php echo $this->exception->getLine() ?></pre>
</dd>
<dt><?php echo $this->translate('Message') ?>:</dt>
<dd>
<pre class="prettyprint linenums"><?php echo $e->getMessage() ?></pre>
<pre class="prettyprint linenums"><?php echo $this->exception->getMessage() ?></pre>
</dd>
<dt><?php echo $this->translate('Stack trace') ?>:</dt>
<dd>
<pre class="prettyprint linenums"><?php echo \UnicaenApp\Util::formatTraceString($e->getTraceAsString()) ?></pre>
<pre class="prettyprint linenums"><?php echo \UnicaenApp\Util::formatTraceString($this->exception->getTraceAsString()) ?></pre>
</dd>
</dl>
</li>
<?php
$e = $e->getPrevious();
endwhile;
?>
</ul>
<?php endif; ?>
<?php
$e = $this->exception->getPrevious();
if ($e) :
?>
<hr/>
<h2><?php echo $this->translate('Previous exceptions') ?>:</h2>
<ul class="unstyled">
<?php while ($e) : ?>
<li>
<h3><?php echo get_class($e); ?></h3>
<dl>
<dt><?php echo $this->translate('File') ?>:</dt>
<dd>
<pre class="prettyprint linenums"><?php echo $e->getFile() ?>:<?php echo $e->getLine() ?></pre>
</dd>
<dt><?php echo $this->translate('Message') ?>:</dt>
<dd>
<pre class="prettyprint linenums"><?php echo $e->getMessage() ?></pre>
</dd>
<dt><?php echo $this->translate('Stack trace') ?>:</dt>
<dd>
<pre class="prettyprint linenums"><?php echo \UnicaenApp\Util::formatTraceString($e->getTraceAsString()) ?></pre>
</dd>
</dl>
</li>
<?php
$e = $e->getPrevious();
endwhile;
?>
</ul>
<?php endif; ?>
<?php else: ?>
<?php else: ?>
<h3><?php echo $this->translate('No Exception available') ?></h3>
<h3><?php echo $this->translate('No Exception available') ?></h3>
<?php endif ?>
<?php endif ?>
<?php endif ?>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment