mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-03 08:37:53 +08:00
Fix err.details check, show message if no details
The array check was wrong, resulting in no message shown and an error about empty string. Also we should output .message if no .details, or at least a generic message if no .message too
This commit is contained in:
parent
961522c8d3
commit
b3df9a5b47
1 changed files with 5 additions and 1 deletions
|
@ -233,8 +233,12 @@ class CreditCardRenderer {
|
|||
this.spinner.unblock();
|
||||
this.errorHandler.clear();
|
||||
|
||||
if (err.details) {
|
||||
if (err.details?.length) {
|
||||
this.errorHandler.message(err.details.map(d => `${d.issue} ${d.description}`).join('<br/>'), true);
|
||||
} else if (err.message) {
|
||||
this.errorHandler.message(err.message, true);
|
||||
} else {
|
||||
this.errorHandler.genericError();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue