<div class="container">
    <div class="typo typocn well">

        <h3><?php echo $this->translate('An error occurred');?></h3>
        <p><?php echo $this->message ?></p>

        <?php if (isset($this->reason) && $this->reason): ?>

        <?php
            $reasonMessage= '';
            switch ($this->reason) {
                case 'error-controller-cannot-dispatch':
                $reasonMessage = $this->translate('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.');
                break;
                case 'error-controller-invalid':
                $reasonMessage = $this->translate('The requested controller was not dispatchable.');
                break;
                case 'error-router-no-match':
                $reasonMessage = $this->translate('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.');
                break;
            }
        ?>

        <p><?php echo $reasonMessage ?></p>

        <?php endif ?>

        <?php if (isset($this->controller) && $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></b>
    </dl>

    <?php endif ?>

    <?php if (isset($this->exception) && $this->exception): ?>

    <h3><?php echo $this->translate('Exception') ?>:</h3>

    <p><?php echo $this->escapeHtml($this->exception->getMessage()) ?></p>

    <?php $traces = $this->exception->getTrace();?>

    <h3><?php echo $this->translate('SQL Query') ?>:</h3>
    <?php foreach($traces as $trace):?>
    <?php if(isset($trace['args'][0])): $trace = $trace['args'][0];?>
    <?php if($trace instanceof \Zend\Db\Sql\Select):?>
    <pre><?php echo $this->escapeHtml($trace->getSqlString(new \Zend\Db\Adapter\Platform\Mysql()))?>;</pre>
    <?php endif?>
    <?php endif?>
    <?php endforeach?>

    <h4><?php echo $this->translate('Stack trace') ?>:</h4>

    <?php if(isset($this->exception->xdebug_message)):?>
    <table class="table">
        <?php echo $this->exception->xdebug_message?>
    </table>
    <?php else:?>
    <pre>
        <?php echo $this->exception->getTraceAsString() ?>
    </pre>
    <?php endif?>

    <?php endif ?>

</div>
</div>
