Skip to content

Commit 9ed3ba3

Browse files
committed
Update application skeleton to use new traps
Use the new error and exception traps in new applications.
1 parent 118bad5 commit 9ed3ba3

1 file changed

Lines changed: 5 additions & 9 deletions

File tree

config/bootstrap.php

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@
3737
use Cake\Database\TypeFactory;
3838
use Cake\Database\Type\StringType;
3939
use Cake\Datasource\ConnectionManager;
40-
use Cake\Error\ConsoleErrorHandler;
41-
use Cake\Error\ErrorHandler;
40+
use Cake\Error\ErrorTrap;
41+
use Cake\Error\ExceptionTrap;
4242
use Cake\Http\ServerRequest;
4343
use Cake\Log\Log;
4444
use Cake\Mailer\Mailer;
@@ -122,17 +122,13 @@
122122
/*
123123
* Register application error and exception handlers.
124124
*/
125-
$isCli = PHP_SAPI === 'cli';
126-
if ($isCli) {
127-
(new ConsoleErrorHandler(Configure::read('Error')))->register();
128-
} else {
129-
(new ErrorHandler(Configure::read('Error')))->register();
130-
}
125+
(new ErrorTrap(Configure::read('Error')))->register();
126+
(new ExceptionTrap(Configure::read('Error')))->register();
131127

132128
/*
133129
* Include the CLI bootstrap overrides.
134130
*/
135-
if ($isCli) {
131+
if (PHP_SAPI === 'cli') {
136132
require CONFIG . 'bootstrap_cli.php';
137133
}
138134

0 commit comments

Comments
 (0)