mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-09 23:24:06 -08:00
Avoid logging error messages for webhook request failures
This commit is contained in:
parent
f685ba01b6
commit
47a77eabf2
|
@ -18,6 +18,7 @@ use App\Notifications\CheckoutAccessoryNotification;
|
|||
use App\Notifications\CheckoutAssetNotification;
|
||||
use App\Notifications\CheckoutConsumableNotification;
|
||||
use App\Notifications\CheckoutLicenseSeatNotification;
|
||||
use GuzzleHttp\Exception\ClientException;
|
||||
use Illuminate\Support\Facades\Notification;
|
||||
use Exception;
|
||||
use Log;
|
||||
|
@ -61,6 +62,16 @@ class CheckoutableListener
|
|||
);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
if ($e instanceof ClientException){
|
||||
$statusCode = $e->getResponse()->getStatusCode();
|
||||
// If status code is in 400 range, we don't want to log it as an error
|
||||
// @todo: 300 and 500 as well?
|
||||
if ($statusCode >= 400 && $statusCode < 500) {
|
||||
Log::debug("Exception caught during checkout notification: ".$e->getMessage());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Log::error("Exception caught during checkout notification: ".$e->getMessage());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue