3
0
mirror of https://github.com/snipe/snipe-it.git synced 2025-12-01 11:30:10 +00:00

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
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'));
}