Merge pull request #15592 from spencerrlongg/bug/catch_request_notify_errors

Catch Errors Around Request Notifications
This commit is contained in:
snipe 2024-10-01 20:26:42 +01:00 committed by GitHub
commit 45ab49eeab
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 4 deletions

View file

@ -240,7 +240,7 @@ class AcceptanceController extends Controller
try {
$acceptance->notify(new AcceptanceAssetAcceptedNotification($data));
} catch (\Exception $e) {
Log::error($e);
Log::warning($e);
}
event(new CheckoutAccepted($acceptance));

View file

@ -13,6 +13,7 @@ use App\Notifications\RequestAssetNotification;
use Illuminate\Http\Request;
use Illuminate\Http\RedirectResponse;
use \Illuminate\Contracts\View\View;
use Log;
/**
* This controller handles all actions related to the ability for users
@ -179,8 +180,11 @@ class ViewAssetsController extends Controller
$asset->decrement('requests_counter', 1);
$logaction->logaction('request canceled');
try {
$settings->notify(new RequestAssetCancelation($data));
} catch (\Exception $e) {
Log::warning($e);
}
return redirect()->route('requestable-assets')
->with('success')->with('success', trans('admin/hardware/message.requests.canceled'));
}
@ -188,7 +192,11 @@ class ViewAssetsController extends Controller
$logaction->logaction('requested');
$asset->request();
$asset->increment('requests_counter', 1);
try {
$settings->notify(new RequestAssetNotification($data));
} catch (\Exception $e) {
Log::warning($e);
}
return redirect()->route('requestable-assets')->with('success')->with('success', trans('admin/hardware/message.requests.success'));
}