Skip to content
Snippets Groups Projects
Commit 47c1b85c authored by mattwire's avatar mattwire
Browse files

Fix error message on AJAX 500 error

parent 92bd4c7a
No related branches found
No related tags found
1 merge request!2096.8
...@@ -307,18 +307,21 @@ ...@@ -307,18 +307,21 @@
*/ */
stripePaymentIntentProcessFail: function(failObject) { stripePaymentIntentProcessFail: function(failObject) {
var error = ts('Unknown error'); var error = ts('Unknown error');
if (failObject.hasOwnProperty('error_message')) { if (typeof failObject !== 'undefined') {
// From an API4 exception if (failObject.hasOwnProperty('error_message')) {
error = failObject.error_message; // From an API4 exception
} error = failObject.error_message;
else if (failObject.hasOwnProperty('statusText') && (failObject.statusText !== 'OK')) {
// A PHP exit can return 200 "OK" but we don't want to display "OK" as the error!
if (failObject.statusText === 'parsererror') {
error = ts('Configuration error - unable to process paymentIntent');
}
else {
error = failObject.statusText;
} }
else
if (failObject.hasOwnProperty('statusText') && (failObject.statusText !== 'OK')) {
// A PHP exit can return 200 "OK" but we don't want to display "OK" as the error!
if (failObject.statusText === 'parsererror') {
error = ts('Configuration error - unable to process paymentIntent');
}
else {
error = failObject.statusText;
}
}
} }
CRM.payment.displayError(error, true); CRM.payment.displayError(error, true);
script.reloadReCAPTCHA(); script.reloadReCAPTCHA();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment