Avoid logging error messages for webhook request failures
This commit is contained in:
parent
f685ba01b6
commit
47a77eabf2
1 changed files with 11 additions and 0 deletions
|
@ -18,6 +18,7 @@ use App\Notifications\CheckoutAccessoryNotification;
|
||||||
use App\Notifications\CheckoutAssetNotification;
|
use App\Notifications\CheckoutAssetNotification;
|
||||||
use App\Notifications\CheckoutConsumableNotification;
|
use App\Notifications\CheckoutConsumableNotification;
|
||||||
use App\Notifications\CheckoutLicenseSeatNotification;
|
use App\Notifications\CheckoutLicenseSeatNotification;
|
||||||
|
use GuzzleHttp\Exception\ClientException;
|
||||||
use Illuminate\Support\Facades\Notification;
|
use Illuminate\Support\Facades\Notification;
|
||||||
use Exception;
|
use Exception;
|
||||||
use Log;
|
use Log;
|
||||||
|
@ -61,6 +62,16 @@ class CheckoutableListener
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} 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());
|
Log::error("Exception caught during checkout notification: ".$e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue