Fix exception handling in job classes

This commit is contained in:
Matteo Gheza 2024-01-17 17:54:55 +01:00
parent b04ab5aa20
commit 215b15946e
4 changed files with 50 additions and 43 deletions

View File

@ -55,7 +55,7 @@ class NotifyUsersManualModeOnJob implements ShouldQueue
}
}
public function failed(\Error|\TypeError $exception = null)
public function failed($exception = null)
{
if (app()->bound('sentry')) {
app('sentry')->captureException($exception);

View File

@ -24,4 +24,11 @@ class RemoveOldIpAddressesFromLogsJob implements ShouldQueue
Log::where('created_at', '<', Carbon::now()->subWeeks(2))
->update(['ip' => null]);
}
public function failed($exception = null)
{
if (app()->bound('sentry')) {
app('sentry')->captureException($exception);
}
}
}

View File

@ -50,7 +50,7 @@ class ResetAvailabilityMinutesJob implements ShouldQueue
}
}
public function failed(\Error|\TypeError $exception = null)
public function failed($exception = null)
{
if (app()->bound('sentry')) {
app('sentry')->captureException($exception);

View File

@ -95,7 +95,7 @@ class UpdateAvailabilityWithSchedulesJob implements ShouldQueue
TelegramBot::sendTeamMessage($text);
}
public function failed(\Error|\TypeError $exception = null)
public function failed($exception = null)
{
if (app()->bound('sentry') && !is_null($exception)) {
app('sentry')->captureException($exception);