TYPO3 Whoops
, (*1)
Use the whoops error/ exception handler instead of the default DebugExceptionHandler
shipped within the TYPO3 core. This supports you with a nicer exception handling output in the frontend or on cli during
extension development. Should only be used in a (local) development context!, (*2)
Getting started
Install using composer
$ composer require --dev portrino/typo3-whoops
Activation
via AdditionalConfiguration.php
Add the following lines into your typo3conf/AdditionalConfiguration.php
:, (*3)
$GLOBALS['TYPO3_CONF_VARS']['SYS']['debugExceptionHandler'] =
\Portrino\Typo3Whoops\Error\WhoopsExceptionHandler::class;
$GLOBALS['TYPO3_CONF_VARS']['SYS']['productionExceptionHandler'] =
\Portrino\Typo3Whoops\Error\WhoopsExceptionHandler::class;
We highly recommend to use a context related condition around it. For example:, (*4)
$applicationContext = \TYPO3\CMS\Core\Utility\GeneralUtility::getApplicationContext()->__toString();
if (strpos($applicationContext, 'Development') !== false) {
$GLOBALS['TYPO3_CONF_VARS']['SYS']['debugExceptionHandler'] =
\Portrino\Typo3Whoops\Error\WhoopsExceptionHandler::class;
$GLOBALS['TYPO3_CONF_VARS']['SYS']['productionExceptionHandler'] =
\Portrino\Typo3Whoops\Error\WhoopsExceptionHandler::class;
}
Compatibility for PHP versions < 7
Because the ExceptionHandlerInterface
under php5.5 and 5.6 differs from the one from php > 7
we provide you a compatible version of the WhoopsExceptionHandler
., (*5)
$GLOBALS['TYPO3_CONF_VARS']['SYS']['debugExceptionHandler'] =
\Portrino\Typo3Whoops\Compatibility\Error\WhoopsExceptionHandler::class;
$GLOBALS['TYPO3_CONF_VARS']['SYS']['productionExceptionHandler'] =
\Portrino\Typo3Whoops\Compatibility\Error\WhoopsExceptionHandler::class;
via TYPO3 Console
typo3cms configuration:set --path SYS/debugExceptionHandler --value "Portrino\\Typo3Whoops\\Error\\WhoopsExceptionHandler"
typo3cms configuration:set --path SYS/productionExceptionHandler --value "Portrino\\Typo3Whoops\\Error\\WhoopsExceptionHandler"
Usage
Now trigger an exception somewhere in your extension code and you should see php errors for cool kids., (*6)
, (*7)
Authors
, (*8)
-
Axel Böswetter - Initial work - EvilBMP
-
André Wuttig - Bugfixes, Unit Tests, Acceptance Tests, Travis CI Integration - aWuttig
See also the list of contributors who participated in this project., (*9)