catch exception

This commit is contained in:
David Remer 2020-07-01 16:49:57 +03:00
parent 85944d392a
commit 3a4b942663

View file

@ -5,6 +5,7 @@ namespace Inpsyde\PayPalCommerce\Onboarding\Render;
use Inpsyde\PayPalCommerce\ApiClient\Endpoint\PartnerReferrals;
use Inpsyde\PayPalCommerce\ApiClient\Exception\RuntimeException;
class OnboardingRenderer
{
@ -16,6 +17,7 @@ class OnboardingRenderer
}
public function render() {
try {
$url = add_query_arg(
[
'displayMode' => 'minibrowser',
@ -59,5 +61,20 @@ class OnboardingRenderer
</td>
</tr>
<?php
} catch(RuntimeException $exception) {
?>
<tr valign="top">
<th scope="row" class="titledesc">
<?php echo esc_html_e('Connect to PayPal', 'woocommerce-paypal-commerce-gateway'); ?>
</th>
<td>
<?php echo esc_html_e(
'We could not properly connect to PayPal. Please reload the page to continue',
'woocommerce-paypal-commerce-gateway'
); ?>
</td>
</tr>
<?php
}
}
}