<?php
/**
 * @var \App\View\AppView $this
 * @var string $message
 * @var string $url
 */
use Cake\Core\Configure;
use Cake\Error\Debugger;

if (Configure::read('debug')) {
    $this->setLayout('dev_error');
    $this->assign('title', $message);
    $this->assign('templateName', 'error500.php');
    $this->start('file');
    ?>
<?php if ($error instanceof Error) : ?>
    <?php $file = $error->getFile() ?>
    <?php $line = $error->getLine() ?>
    <strong>Error in: </strong>
    <?= $this->Html->link(sprintf('%s, line %s', Debugger::trimPath($file), $line), Debugger::editorUrl($file, $line)); ?>
<?php endif; ?>
<?php
    echo $this->element('auto_table_warning');
    $this->end();
} else {
    $this->setLayout('landing');
    $this->assign('title', 'Something went wrong');
}
?>
<?php if (!Configure::read('debug')) : ?>
<div class="mx-auto max-w-2xl px-6 py-14 md:py-20 text-neutral-800">
<?php endif; ?>
<h2 class="font-serif text-2xl font-semibold text-ink-900 md:text-3xl"><?= __d('cake', 'An Internal Error Has Occurred.') ?></h2>
<p class="mt-4 text-neutral-600 leading-relaxed">
    <span class="font-semibold text-ink-900"><?= __d('cake', 'Error') ?>: </span>
    <?= h($message) ?>
</p>
<?php if (!Configure::read('debug')) : ?>
    <p class="mt-10">
        <?= $this->Html->link(
            '← Back to home',
            '/',
            ['class' => 'text-sm font-semibold text-primary-600 hover:text-primary-800']
        ) ?>
    </p>
</div>
<?php endif; ?>
