From d568ab3ac6a07a395eefe1bc49a49628e1ee0c14 Mon Sep 17 00:00:00 2001 From: Matthew Wire <mjw@mjwconsult.co.uk> Date: Sat, 20 Feb 2021 17:50:43 +0000 Subject: [PATCH] Fix display of unknown errors in case of (eg.) PHP exit --- js/civicrm_stripe.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/js/civicrm_stripe.js b/js/civicrm_stripe.js index 83267291..01ad1d61 100644 --- a/js/civicrm_stripe.js +++ b/js/civicrm_stripe.js @@ -275,7 +275,8 @@ .fail(function(object) { // Triggered when http code !== 200 (eg. 400 Bad request) var error = 'Unknown error'; - if (object.hasOwnProperty('statusText')) { + if (object.hasOwnProperty('statusText') && (object.statusText !== 'OK')) { + // A PHP exit can return 200 "OK" but we don't want to display "OK" as the error! error = object.statusText; } displayError(error, true); -- GitLab