Catch all exceptions during dcc/pui status check

This commit is contained in:
Alex P 2022-08-17 16:17:29 +03:00
parent dda243f1c9
commit 8b131d5c37
2 changed files with 5 additions and 7 deletions

View file

@ -9,9 +9,9 @@ declare( strict_types=1 );
namespace WooCommerce\PayPalCommerce\WcGateway\Helper;
use Throwable;
use WooCommerce\PayPalCommerce\ApiClient\Endpoint\PartnersEndpoint;
use WooCommerce\PayPalCommerce\ApiClient\Entity\SellerStatusProduct;
use WooCommerce\PayPalCommerce\ApiClient\Exception\RuntimeException;
use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
/**
@ -22,7 +22,7 @@ class DCCProductStatus {
/**
* Caches the status for the current load.
*
* @var string|null
* @var bool|null
*/
private $current_status_cache;
/**
@ -57,7 +57,6 @@ class DCCProductStatus {
* Whether the active/subscribed products support DCC.
*
* @return bool
* @throws \WooCommerce\PayPalCommerce\WcGateway\Exception\NotFoundException Should a setting not be found.
*/
public function dcc_is_active() : bool {
if ( is_bool( $this->current_status_cache ) ) {
@ -70,7 +69,7 @@ class DCCProductStatus {
try {
$seller_status = $this->partners_endpoint->seller_status();
} catch ( RuntimeException $error ) {
} catch ( Throwable $error ) {
$this->current_status_cache = false;
return false;
}

View file

@ -9,11 +9,10 @@ declare( strict_types=1 );
namespace WooCommerce\PayPalCommerce\WcGateway\Helper;
use Throwable;
use WooCommerce\PayPalCommerce\ApiClient\Endpoint\PartnersEndpoint;
use WooCommerce\PayPalCommerce\ApiClient\Entity\SellerStatusProduct;
use WooCommerce\PayPalCommerce\ApiClient\Exception\RuntimeException;
use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
use WooCommerce\PayPalCommerce\WcGateway\Exception\NotFoundException;
/**
* Class PayUponInvoiceProductStatus
@ -70,7 +69,7 @@ class PayUponInvoiceProductStatus {
try {
$seller_status = $this->partners_endpoint->seller_status();
} catch ( RuntimeException $error ) {
} catch ( Throwable $error ) {
$this->current_status_cache = false;
return false;
}