[IMP] *: remove guarded catch
This commit removes the promise extension which added the function `guardedCatch`. It was used to filter server and connection errors from javascript errors. Instead of using guardedCatch, we should use catch and check if the reason is a server or connection error if needed and re-throw the error if it's not handled. closes odoo/odoo#137702 Task: 3439226 Related: odoo/enterprise#48451 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
This commit is contained in:
@@ -5,6 +5,7 @@ import { _t } from '@web/core/l10n/translation';
|
||||
import { loadJS } from '@web/core/assets';
|
||||
|
||||
import paymentForm from '@payment/js/payment_form';
|
||||
import { RPCError } from '@web/core/network/rpc_service';
|
||||
|
||||
paymentForm.include({
|
||||
|
||||
@@ -145,10 +146,13 @@ paymentForm.include({
|
||||
'access_token': processingValues.access_token,
|
||||
}).then(() => {
|
||||
window.location = '/payment/status';
|
||||
}).guardedCatch((error) => {
|
||||
error.event.preventDefault();
|
||||
this._displayErrorDialog(_t("Payment processing failed"), error.message.data.message);
|
||||
this._enableButton();
|
||||
}).catch((error) => {
|
||||
if (error instanceof RPCError) {
|
||||
this._displayErrorDialog(_t("Payment processing failed"), error.data.message);
|
||||
this._enableButton();
|
||||
} else {
|
||||
return Promise.reject(error);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user