SHARE
TWEET

Untitled

a guest Apr 21st, 2017 45 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function promise(){
  2.     return new Promise(function(resolve,reject){
  3.         setTimeout(function(){
  4.             JSON.parse('ok'); //disparando excepci├│n
  5.         },100);
  6.     });
  7. }
  8.  
  9. promise()
  10.     .then(null,function(error){
  11.         alert('entrando a onRejected');
  12.         alert(error);
  13.         throw new Error('┬┐catch me atrapas?');
  14.     })
  15.     .catch(function(error){
  16.         alert('entrando a catch');
  17.         alert(error);
  18.     });`
RAW Paste Data
Top