Console and web don't use the same config
The Exception and error config have separate options to the standard exception and error config:
consoleHandler - callback - The callback used to handle errors when running in the console. If undefined, CakePHP’s default handlers will be used.
This is also apparent from the source.
As such to configure a different handler to be used for both web and cli requests - define both the handler
and consoleHandler
keys:
Configure::write('Error', array(
'handler' => 'SentryErrorHandler::handleError',
'consoleHandler' => 'SentryErrorHandler::handleError', # <--
'level' => E_ALL & ~E_DEPRECATED,
'trace' => true
));
Configure::write('Exception', array(
'handler' => 'SentryErrorHandler::handleException',
'consoleHandler' => 'SentryErrorHandler::handleException', # <--
'renderer' => 'ExceptionRenderer',
'log' => true
));