Skip to content

Commit

Permalink
Fix more error pages.
Browse files Browse the repository at this point in the history
Update several error pages and remove missing_table as it is impossible
to reach now.
  • Loading branch information
markstory committed Dec 6, 2014
1 parent 8074956 commit a73dbef
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 82 deletions.
25 changes: 12 additions & 13 deletions src/Template/Error/missing_layout.ctp
Expand Up @@ -12,16 +12,21 @@
* @since 0.10.0
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/

$this->layout = 'dev_error';

$this->assign('title', 'Missing Layout');
$this->assign('templateName', 'missing_layout.ctp');

$this->start('subheading');
?>
<h2>Missing Layout</h2>
<p class="error">
<strong>Error: </strong>
<?= sprintf('The layout file <em>%s</em> can not be found or does not exist.', h($file)); ?>
</p>
The layout file <em><?= h($file) ?></em> can not be found or does not exist.
<?php $this->end() ?>

<?php $this->start('file') ?>
<p>
<?= sprintf('Confirm you have created the file: %s', h($file)); ?>
in one of the following paths:
Confirm you have created the file: <?= h($file) ?> in one of the following paths:
</p>
<ul>
<?php
Expand All @@ -34,10 +39,4 @@
endforeach;
?>
</ul>

<p class="notice">
<strong>Notice: </strong>
<?= sprintf('If you want to customize this error message, create %s', APP_DIR . DS . 'Template' . DS . 'Error' . DS . 'missing_layout.ctp'); ?>
</p>

<?= $this->element('exception_stack_trace'); ?>
<?php $this->end() ?>
50 changes: 30 additions & 20 deletions src/Template/Error/missing_plugin.ctp
Expand Up @@ -14,32 +14,42 @@
*/
use Cake\Core\Configure;

$this->layout = 'dev_error';

$pluginPath = Configure::read('App.paths.plugins.0');

$this->assign('title', 'Missing Plugin');
$this->assign('templateName', 'missing_plugin.ctp');

$this->start('subheading');
?>
<h2>Missing Plugin</h2>
<p class="error">
<strong>Error: </strong>
<?= sprintf('The application is trying to load a file from the <em>%s</em> plugin', h($plugin)); ?>
</p>
<p class="error">
<strong>Error: </strong>
<?= $this->element('plugin_class_error'); ?>
</p>
<pre>
&lt;?php
Plugin::load('<?= h($plugin)?>');
The application is trying to load a file from the <em><?= h($plugin) ?></em> plugin.
<br>
<br>
Make sure your plugin <em><?= h($plugin) ?></em> is in the <?= h($pluginPath) ?> directory and was loaded.
<?php $this->end() ?>

<?php $this->start('file') ?>
<?php
$code = <<<PHP
<?php
Plugin::load('{$plugin}');
PHP;

?>
<div class="code-dump"><?php highlight_string($code) ?></div>

</pre>
<p class="notice">
<strong>Loading all plugins: </strong>
<?= sprintf('If you wish to load all plugins at once, use the following line in your %s file', 'config' . DS . 'bootstrap.php'); ?>
</p>
<pre>
Plugin::loadAll();
</pre>
<p class="notice">
<strong>Notice: </strong>
<?= sprintf('If you want to customize this error message, create %s', APP_DIR . DS . 'Template' . DS . 'Error' . DS . 'missing_plugin.ctp'); ?>
</p>

<?= $this->element('exception_stack_trace'); ?>
<?php
$code = <<<PHP
<?php
Plugin::loadAll();
PHP;
?>
<div class="code-dump"><?php highlight_string($code) ?></div>
<?php $this->end() ?>
22 changes: 11 additions & 11 deletions src/Template/Error/missing_route.ctp
Expand Up @@ -16,14 +16,19 @@
use Cake\Routing\Router;
use Cake\Error\Debugger;

$this->layout = 'dev_error';

$this->assign('title', 'Missing Route');
$this->assign('templateName', 'missing_route.ctp');

$this->start('subheading');
?>
<h2>Missing Route</h2>
<p class="error">
<strong>Error: </strong>
<?= $error->getMessage(); ?>
</p>
<?php $this->end() ?>

<p class="notice">None of the currently connected routes match the given URL or parameters.
<?php $this->start('file') ?>
<p>None of the currently connected routes match the given URL or parameters.
Add a matching route to <?= 'config' . DS . 'routes.php' ?></p>

<h3>Connected Routes</h3>
Expand All @@ -33,7 +38,7 @@ Add a matching route to <?= 'config' . DS . 'routes.php' ?></p>
foreach (Router::routes() as $route):
echo '<tr>';
printf(
'<th width="25%%">%s</th><th>%s</th><th width="20%%">%s</th>',
'<td width="25%%">%s</td><td>%s</td><td width="20%%">%s</td>',
$route->template,
Debugger::exportVar($route->defaults),
Debugger::exportVar($route->options)
Expand All @@ -42,9 +47,4 @@ foreach (Router::routes() as $route):
endforeach;
?>
</table>

<p class="notice">
<strong>Notice: </strong>
<?= sprintf('If you want to customize this error message, create %s', APP_DIR . DS . 'Template' . DS . 'Error' . DS . 'missing_route.ctp'); ?>
</p>
<?= $this->element('exception_stack_trace'); ?>
<?php $this->end() ?>
27 changes: 0 additions & 27 deletions src/Template/Error/missing_table.ctp

This file was deleted.

20 changes: 10 additions & 10 deletions src/Template/Error/missing_template.ctp
Expand Up @@ -13,13 +13,19 @@
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
use Cake\Utility\Inflector;

$this->layout = 'dev_error';

$this->assign('title', 'Missing Template');
$this->assign('templateName', 'missing_template.ctp');

$this->start('subheading');
?>
<h2>Missing Template</h2>
<p class="error">
<strong>Error: </strong>
<?= sprintf('The view for <em>%sController::%s()</em> was not found.', h(Inflector::camelize($this->request->controller)), h($this->request->action)); ?>
</p>
<?php $this->end() ?>

<?php $this->start('file') ?>
<p>
<?= sprintf('Confirm you have created the file: "%s"', h($file)) ?>
in one of the following paths:
Expand All @@ -35,10 +41,4 @@ use Cake\Utility\Inflector;
endforeach;
?>
</ul>

<p class="notice">
<strong>Notice: </strong>
<?= sprintf('If you want to customize this error message, create %s', APP_DIR . DS . 'Template' . DS . 'Error' . DS . 'missing_template.ctp') ?>
</p>

<?= $this->element('exception_stack_trace'); ?>
<?php $this->end() ?>
15 changes: 14 additions & 1 deletion src/Template/Layout/dev_error.ctp
Expand Up @@ -48,7 +48,7 @@ use Cake\Error\Debugger;
</div>

<?php if ($this->fetch('templateName')): ?>
<p class="notice">
<p class="customize">
If you want to customize this error message, create
<em><?= APP_DIR . DS . 'Template' . DS . 'Error' . DS . $this->fetch('templateName') ?></em>
</p>
Expand Down Expand Up @@ -189,6 +189,9 @@ header {
.error {
background: #ffd54f;
}
.customize {
opacity: 0.6;
}

.stack-trace {
list-style: none;
Expand Down Expand Up @@ -277,6 +280,16 @@ header {
.excerpt-number:after {
content: attr(data-number);
}

table {
text-align: left;
}
th, td {
padding: 4px;
}
th {
border-bottom: 1px solid #ccc;
}
</style>

</body>
Expand Down

0 comments on commit a73dbef

Please sign in to comment.