From 65b3006adf279eb9c2809fd3589a16764df6300c Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Thu, 10 Aug 2023 14:08:55 +0200 Subject: [PATCH] Check if `\Throwable` instead of `\Exception`.. ..everywhere else... fixes #5079 --- library/Icinga/Application/Logger.php | 6 +++--- library/Icinga/Exception/IcingaException.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/library/Icinga/Application/Logger.php b/library/Icinga/Application/Logger.php index 347af4479..937029c97 100644 --- a/library/Icinga/Application/Logger.php +++ b/library/Icinga/Application/Logger.php @@ -3,13 +3,13 @@ namespace Icinga\Application; -use Exception; use Icinga\Data\ConfigObject; use Icinga\Application\Logger\Writer\FileWriter; use Icinga\Application\Logger\Writer\SyslogWriter; use Icinga\Exception\ConfigurationError; use Icinga\Exception\IcingaException; use Icinga\Util\Json; +use Throwable; /** * Logger @@ -234,7 +234,7 @@ class Logger if (count($arguments) === 1) { $message = $arguments[0]; - if ($message instanceof Exception) { + if ($message instanceof Throwable) { $messages = array(); $error = $message; do { @@ -250,7 +250,7 @@ class Logger array_shift($arguments), array_map( function ($a) { - return is_string($a) ? $a : ($a instanceof Exception + return is_string($a) ? $a : ($a instanceof Throwable ? IcingaException::describe($a) : Json::encode($a)); }, diff --git a/library/Icinga/Exception/IcingaException.php b/library/Icinga/Exception/IcingaException.php index 0069a3c73..58e17dbd1 100644 --- a/library/Icinga/Exception/IcingaException.php +++ b/library/Icinga/Exception/IcingaException.php @@ -22,7 +22,7 @@ class IcingaException extends Exception $args = array_slice(func_get_args(), 1); $exc = null; foreach ($args as &$arg) { - if ($arg instanceof Exception) { + if ($arg instanceof Throwable) { $exc = $arg; } }