netlogix/nxerrorhandler

Error handler with static pages for TYPO3

Installs: 1 457

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 4

Forks: 0

Open Issues: 0

Type:typo3-cms-extension

6.0.4 2023-03-21 11:50 UTC

This package is auto-updated.

Last update: 2023-05-21 12:24:00 UTC


README

stability-wip TYPO3 V10 TYPO3 V11 Minimum PHP Version GitHub CI status

Improves error handling in TYPO3. Can send exceptions by mail and uses statically rendered error documents for output to reduce strain on the server.

This extension is a work in progress.

Usage

Add this to your LocalConfiguration.php

return [
    'EXTENSIONS' => [
        'nxerrorhandler' => [
            'exceptionHandlerComponents' => [
                \Netlogix\Nxerrorhandler\ErrorHandler\Component\ExtbaseArgumentsToBadRequestComponent::class,
                \Netlogix\Nxerrorhandler\ErrorHandler\Component\StaticDocumentComponent::class,
            ],
        ]
    ],
    'FE' => [
        'pageNotFound_handling' => 'USER_FUNCTION:' . \Netlogix\Nxerrorhandler\ErrorHandler\PageNotFoundHandler::class . '->handlePageNotFound'
    ],
    'SYS' => [
        'productionExceptionHandler' => \Netlogix\Nxerrorhandler\ErrorHandler\GeneralExceptionHandler::class
    ],
];

Note: this will register the ExceptionHandler for all contexts including backend requests. If you want to restrict it to frontend requests only then add this line to AdditionalConfiguration.php instead:

    if (TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_FE) {
        $GLOBALS['TYPO3_CONF_VARS']['SYS']['productionExceptionHandler'] = \Netlogix\Nxerrorhandler\ErrorHandler\GeneralExceptionHandler::class;
    }

Add this to your config/sites/sitename/config.yaml

errorHandling:
  - errorCode: '400'
    errorHandler: PHP
    errorPhpClassFQCN: Netlogix\Nxerrorhandler\Error\PageContentErrorHandler
    errorContentSource: 't3://page?uid=99'
  - errorCode: '404'
    errorHandler: PHP
    errorPhpClassFQCN: Netlogix\Nxerrorhandler\Error\PageContentErrorHandler
    errorContentSource: 't3://page?uid=99'
  - errorCode: '500'
    errorHandler: PHP
    errorPhpClassFQCN: Netlogix\Nxerrorhandler\Error\PageContentErrorHandler
    errorContentSource: 't3://page?uid=99'