Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

return new Promise(res => {

// the execution: catch -> then
new Promise((resolve, reject) => {

  throw new Error("Whoops!");

}).catch(function(error) {

  alert("The error is handled, continue normally");

}).then(() => alert("Next successful handler runs"));
Source by tr.javascript.info #
 
PREVIOUS NEXT
Tagged: #return
ADD COMMENT
Topic
Name
3+3 =