diff --git a/includes/discovery/functions.inc.php b/includes/discovery/functions.inc.php index d9a5c09073..8bd0e1d225 100644 --- a/includes/discovery/functions.inc.php +++ b/includes/discovery/functions.inc.php @@ -157,6 +157,11 @@ function discover_device(&$device, $force_module = false) Log::error("%rError discovering $module module for {$device['hostname']}.%n $e", ['color' => true]); \App\Models\Eventlog::log("Error discovering $module module. Check log file for more details.", $device['device_id'], 'discovery', Alert::ERROR); report($e); + + // Re-throw exception if we're in CI + if (getenv('CI') == true) { + throw $e; + } } $module_time = microtime(true) - $module_start; diff --git a/includes/polling/functions.inc.php b/includes/polling/functions.inc.php index c3a0dc5581..1e2d7041a1 100644 --- a/includes/polling/functions.inc.php +++ b/includes/polling/functions.inc.php @@ -342,6 +342,11 @@ function poll_device($device, $force_module = false) Log::error("%rError polling $module module for {$device['hostname']}.%n $e", ['color' => true]); \App\Models\Eventlog::log("Error polling $module module. Check log file for more details.", $device['device_id'], 'poller', Alert::ERROR); report($e); + + // Re-throw exception if we're in CI + if (getenv('CI') == true) { + throw $e; + } } $module_time = microtime(true) - $module_start;