<?php
/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */

// @codingStandardsIgnoreFile

?>
<header class="header">
    <img class="logo" src="<?php echo $this->basePath() ?>/pub/images/magento-icon.svg" alt="Magento"/>
    <h1 class="header-title">An error occurred</h1>
</header>

<h2><?php echo $this->message ?></h2>

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

    <?php if ( isset( $this->exception ) && $this->exception instanceof Exception ): ?>
        <hr/>
        <h2>Additional information:</h2>
        <h3><?php echo get_class( $this->exception ); ?></h3>
        <dl>
            <dt>File:</dt>
            <dd>
                <pre class="prettyprint linenums"><?php echo $this->exception->getFile() ?>:<?php echo $this->exception->getLine() ?></pre>
            </dd>

            <dt>Message:</dt>
            <dd>
                <pre class="prettyprint linenums"><?php echo $this->escapeHtml( $this->exception->getMessage() ) ?></pre>
            </dd>

            <dt>Stack trace:</dt>
            <dd>
                <pre class="prettyprint linenums"><?php echo $this->escapeHtml( $this->exception->getTraceAsString() ) ?></pre>
            </dd>
        </dl>
        <?php
        $e = $this->exception->getPrevious();
        if ( $e ) :
            ?>
            <hr/>
            <h2>Previous exceptions:</h2>
            <ul class="unstyled">
                <?php while ( $e ) : ?>
                    <li>
                        <h3><?php echo get_class( $e ); ?></h3>
                        <dl>
                            <dt>File:</dt>
                            <dd>
                                <pre class="prettyprint linenums"><?php echo $e->getFile() ?>:<?php echo $e->getLine() ?></pre>
                            </dd>

                            <dt>Message:</dt>
                            <dd>
                                <pre class="prettyprint linenums"><?php echo $this->escapeHtml( $e->getMessage() ) ?></pre>
                            </dd>

                            <dt>Stack trace:</dt>
                            <dd>
                                <pre class="prettyprint linenums"><?php echo $this->escapeHtml( $e->getTraceAsString() ) ?></pre>
                            </dd>
                        </dl>
                    </li>
                    <?php
                    $e = $e->getPrevious();
                endwhile;
                ?>
            </ul>
        <?php endif; ?>

    <?php else: ?>

        <h3>No Exception available</h3>

    <?php endif ?>

<?php endif ?>
