From 503ac4619ab87ed634c841ec5b71b226c9d3a5cf Mon Sep 17 00:00:00 2001 From: Benedikt Franke Date: Fri, 31 Aug 2018 17:45:41 +0200 Subject: [PATCH] Check if an exception is internal before rethrowing --- src/Error/FormattedError.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Error/FormattedError.php b/src/Error/FormattedError.php index 25d364d..705d822 100644 --- a/src/Error/FormattedError.php +++ b/src/Error/FormattedError.php @@ -235,7 +235,9 @@ class FormattedError $debug = (int) $debug; - if ($debug & Debug::RETHROW_INTERNAL_EXCEPTIONS) { + $isInternal = ! $e instanceof ClientAware || ! $e->isClientSafe(); + + if (($debug & Debug::RETHROW_INTERNAL_EXCEPTIONS) && $isInternal) { if (! $e instanceof Error) { throw $e; } @@ -245,8 +247,6 @@ class FormattedError } } - $isInternal = ! $e instanceof ClientAware || ! $e->isClientSafe(); - if (($debug & Debug::INCLUDE_DEBUG_MESSAGE) && $isInternal) { // Displaying debugMessage as a first entry: $formattedError = ['debugMessage' => $e->getMessage()] + $formattedError;