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;