diff --git a/php/src/exceptions.php b/php/src/exceptions.php index 8bfcb9f..a6b1e88 100644 --- a/php/src/exceptions.php +++ b/php/src/exceptions.php @@ -14,7 +14,8 @@ class exceptions { if ($e instanceof UserException) $userMessage = $e->getUserMessage(); elseif ($e instanceof ExceptionShadow) $userMessage = $e->getUserMessage(); else return null; - return c::to_string($userMessage); + if ($userMessage === null) return null; + else return c::to_string($userMessage); } /** @param Throwable|ExceptionShadow $e */ @@ -22,7 +23,8 @@ class exceptions { if ($e instanceof UserException) $techMessage = $e->getTechMessage(); elseif ($e instanceof ExceptionShadow) $techMessage = $e->getTechMessage(); else return null; - return c::to_string($techMessage); + if ($techMessage === null) return null; + else return c::to_string($techMessage); } /** @param Throwable|ExceptionShadow $e */