Merge pull request #19162 from marcusmoore/fixes/21663-audit-notification

Auditing: Added try catch around sending notification
This commit is contained in:
snipe
2026-06-11 00:41:07 +01:00
committed by GitHub
+13 -4
View File
@@ -449,7 +449,7 @@ trait Loggable
} catch (ServerException $e) {
Log::error('Teams webhook server error', [
Log::warning('Teams webhook server error', [
'endpoint' => $endpoint,
'status' => $e->getResponse()?->getStatusCode(),
'error' => $e->getMessage(),
@@ -464,19 +464,28 @@ trait Loggable
]);
} catch (RequestException $e) {
Log::error('Teams webhook request failure', [
Log::warning('Teams webhook request failure', [
'endpoint' => $endpoint,
'error' => $e->getMessage(),
]);
} catch (Throwable $e) {
Log::error('Teams webhook failed unexpectedly', [
Log::warning('Teams webhook failed unexpectedly', [
'endpoint' => $endpoint,
'exception' => get_class($e),
'error' => $e->getMessage(),
]);
}
} else {
Setting::getSettings()->notify(new AuditNotification($params));
try {
Setting::getSettings()->notify(new AuditNotification($params));
} catch (Throwable $e) {
Log::warning('Audit webhook notification failed', [
'endpoint' => Setting::getSettings()->webhook_endpoint,
'channel' => Setting::getSettings()->webhook_selected,
'exception' => get_class($e),
'error' => $e->getMessage(),
]);
}
}
return $log;