uncaught exception: cancel
See original GitHub issueThis error will show when i click “cancel” button in Sweetalert2
swal({ title: menu_title, text: title, input: "text", showCancelButton: true, animation: "slide-from-top", showLoaderOnConfirm: true, inputPlaceholder: lang.write_your_comment, preConfirm: function(inputValue) { return new Promise(function(resolve, reject) { resolve('ok'); }); }) }, allowOutsideClick: false }).then(function(result){ var res = $.parseJSON(result); if(res.status){ swal({ title: lang.thankyou+"!", text: lang.your_feedback_sent, type: "success" }).then(function(confirm){ location.reload(); }); } else{ swal({ title: lang.sorry+"!", text: res.message, type: "warning" }); } });
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (1 by maintainers)
In case someone comes here and gets stuck (because
sweetalert != sweetalert2
!)At the end of the
swal({...})
, add this:.catch(() => swal.close())
Every promise function needs a failure callback.
@eminx me too!!