Advertisement
Guest User

Untitled

a guest
Apr 21st, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  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. });`
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement