404.phtml 3.15 KB
Newer Older
bertrandgauthier's avatar
bertrandgauthier committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
use Zend\Mvc\Application;
?>
<h1>A 404 error occurred</h1>
<h2><?= $this->message ?></h2>

<?php
if (! empty($this->reason)) :
    $reasonMessage = '';
    switch ($this->reason) {
        case Application::ERROR_CONTROLLER_CANNOT_DISPATCH:
            $reasonMessage = 'The requested controller was unable to dispatch the request.';
            break;
        case Application::ERROR_MIDDLEWARE_CANNOT_DISPATCH:
            $reasonMessage = 'The requested middleware was unable to dispatch the request.';
            break;
        case Application::ERROR_CONTROLLER_NOT_FOUND:
            $reasonMessage = 'The requested controller could not be mapped to an existing controller class.';
            break;
        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 = 'We cannot determine at this time why a 404 was generated.';
            break;
    }
30
    ?>
bertrandgauthier's avatar
bertrandgauthier committed
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105

<p><?= $reasonMessage ?></p>

<?php endif ?>

<?php if (! empty($this->controller)) : ?>
<dl>
    <dt>Controller:</dt>
    <dd><?= $this->escapeHtml($this->controller) ?>
    <?php
    if (! empty($this->controller_class)
        && $this->controller_class != $this->controller
    ) {
        echo sprintf('(resolves to %s)', $this->escapeHtml($this->controller_class));
    }
    ?>
</dd>
</dl>

<?php endif ?>

<?php if (! empty($this->display_exceptions)) : ?>
    <?php if (isset($this->exception)
        && ($this->exception instanceof \Throwable || $this->exception instanceof \Exception)) : ?>
<hr/>
<h2>Additional information:</h2>
<h3><?= get_class($this->exception) ?></h3>
<dl>
    <dt>File:</dt>
    <dd>
        <pre class="prettyprint linenums"><?= $this->exception->getFile() ?>:<?= $this->exception->getLine() ?></pre>
    </dd>
    <dt>Message:</dt>
    <dd>
        <pre class="prettyprint linenums"><?= $this->escapeHtml($this->exception->getMessage()) ?></pre>
    </dd>
    <dt>Stack trace:</dt>
    <dd>
        <pre class="prettyprint linenums"><?= $this->exception->getTraceAsString() ?></pre>
    </dd>
</dl>
        <?php $e = $this->exception->getPrevious() ?>
        <?php if ($e) : ?>
<hr/>
<h2>Previous exceptions:</h2>
<ul class="unstyled">
            <?php while ($e) : ?>
    <li>
        <h3><?= get_class($e) ?></h3>
        <dl>
            <dt>File:</dt>
            <dd>
                <pre class="prettyprint linenums"><?= $e->getFile() ?>:<?= $e->getLine() ?></pre>
            </dd>
            <dt>Message:</dt>
            <dd>
                <pre class="prettyprint linenums"><?= $this->escapeHtml($e->getMessage()) ?></pre>
            </dd>
            <dt>Stack trace:</dt>
            <dd>
                <pre class="prettyprint linenums"><?= $e->getTraceAsString() ?></pre>
            </dd>
        </dl>
    </li>
                <?php $e = $e->getPrevious() ?>
            <?php endwhile ?>
</ul>
        <?php endif ?>

    <?php else : ?>
<h3>No Exception available</h3>

    <?php endif ?>

<?php endif ?>