diff --git a/src/Error/FormattedError.php b/src/Error/FormattedError.php
index <HASH>..<HASH> 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;
Check if an exception is internal before rethrowing