diff --git a/Neos.Flow/Classes/Error/AbstractExceptionHandler.php b/Neos.Flow/Classes/Error/AbstractExceptionHandler.php index 89c86c2c2d..f86f95fb49 100644 --- a/Neos.Flow/Classes/Error/AbstractExceptionHandler.php +++ b/Neos.Flow/Classes/Error/AbstractExceptionHandler.php @@ -213,6 +213,7 @@ protected function resolveRenderingGroup(\Throwable $exception) if (!isset($this->options['renderingGroups'])) { return null; } + foreach ($this->options['renderingGroups'] as $renderingGroupName => $renderingGroupSettings) { if (isset($renderingGroupSettings['matchingExceptionClassNames'])) { foreach ($renderingGroupSettings['matchingExceptionClassNames'] as $exceptionClassName) { @@ -221,8 +222,9 @@ protected function resolveRenderingGroup(\Throwable $exception) } } } - if (isset($renderingGroupSettings['matchingStatusCodes']) && $exception instanceof FlowException) { - if (in_array($exception->getStatusCode(), $renderingGroupSettings['matchingStatusCodes'])) { + if (isset($renderingGroupSettings['matchingStatusCodes'])) { + $statusCode = $exception instanceof FlowException ? $exception->getStatusCode(): 500; + if (in_array($statusCode, $renderingGroupSettings['matchingStatusCodes'])) { return $renderingGroupName; } } diff --git a/Neos.Flow/Documentation/TheDefinitiveGuide/PartIII/ErrorAndExceptionHandling.rst b/Neos.Flow/Documentation/TheDefinitiveGuide/PartIII/ErrorAndExceptionHandling.rst index c5cc864c61..d0634a7291 100644 --- a/Neos.Flow/Documentation/TheDefinitiveGuide/PartIII/ErrorAndExceptionHandling.rst +++ b/Neos.Flow/Documentation/TheDefinitiveGuide/PartIII/ErrorAndExceptionHandling.rst @@ -153,7 +153,7 @@ An example configuration could look like in the following Settings.yaml excerpt: key names, their actual naming has no further implications. ``matchingStatusCodes``: - an array of integer values what HTTP status codes the rendering group is for + an array of integer values what HTTP status codes the rendering group is for. Generic exceptions will be handled as if they had a 500 status code. ``matchingExceptionClassNames``: an array of string values what Exception types the rendering group is for. Keep in mind that, as always