Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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);
- });`
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement