function promise(){
return new Promise(function(resolve,reject){
setTimeout(function(){
JSON.parse('ok'); //disparando excepción
},100);
});
}
promise()
.then(null,function(error){
alert('entrando a onRejected');
alert(error);
throw new Error('¿catch me atrapas?');
})
.catch(function(error){
alert('entrando a catch');
alert(error);
});'
basically believed that when an error or exception occurred during the execution of the promise it was "captured" in the second parameter of the "then" method or in the "catch".
but in this case when an exception occurs within the "setTimeout" for some reason the execution of the promise is not completed, it is more than ever to execute "then" or "catch". if I delete the "setTimeout" error if it is captured in "then", it is as if the error was not propagated inside "setTimeout" to the promise and then to "onRejected".
How can I solve this problem?