-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Open
Description
nopCommerce version: develop
There is a function in public.ajaxcart.js:
ajaxFailure: function () {
alert(this.localized_data.AjaxCartFailure);
}
and it works correctly when ajax cart methods return any data (e.g. return Json(new { success = false, message = "No product found with the specified ID" }); in AddProductToCart_Catalog() method).
But, if an unhandled exception is thrown in these methods, no data is returned and ajaxFailure fails, you can see following in the browser console:
TypeError: Cannot read properties of undefined (reading 'AjaxCartFailure')
at Object.ajaxFailure [as error] (public.ajaxcart.js:181:33)
at c (jquery.min.js:2:25304)
at Object.fireWith [as rejectWith] (jquery.min.js:2:26053)
at l (jquery.min.js:2:77807)
at XMLHttpRequest.<anonymous> (jquery.min.js:2:80265)
This was already mentioned in #6152
Probably, we should just use AjaxCart.localized_data.AjaxCartFailure instead of this.localized_data.AjaxCartFailure. Let's check.