Re-throw exceptions if we're in CI (#14890)

Else they are not shown during tests
This commit is contained in:
Jellyfrog
2023-03-10 15:00:03 +01:00
committed by GitHub
parent f111ac22fe
commit e9f8e64506
2 changed files with 10 additions and 0 deletions

View File

@@ -157,6 +157,11 @@ function discover_device(&$device, $force_module = false)
Log::error("%rError discovering $module module for {$device['hostname']}.%n $e", ['color' => true]); 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); \App\Models\Eventlog::log("Error discovering $module module. Check log file for more details.", $device['device_id'], 'discovery', Alert::ERROR);
report($e); report($e);
// Re-throw exception if we're in CI
if (getenv('CI') == true) {
throw $e;
}
} }
$module_time = microtime(true) - $module_start; $module_time = microtime(true) - $module_start;

View File

@@ -342,6 +342,11 @@ function poll_device($device, $force_module = false)
Log::error("%rError polling $module module for {$device['hostname']}.%n $e", ['color' => true]); 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); \App\Models\Eventlog::log("Error polling $module module. Check log file for more details.", $device['device_id'], 'poller', Alert::ERROR);
report($e); report($e);
// Re-throw exception if we're in CI
if (getenv('CI') == true) {
throw $e;
}
} }
$module_time = microtime(true) - $module_start; $module_time = microtime(true) - $module_start;