Guest User

Untitled

a guest
Feb 12th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. const waitFor = (ms) => new Promise(r => setTimeout(r, ms));
  2.  
  3. start = async () => {
  4. try {
  5. console.log("start");
  6. c = 1;
  7. while(c < 10){
  8. await waitFor(2000)
  9. console.log('waiting!');
  10. if(c === 3){
  11. console.log('errrorr!!')
  12. throw new Error('dasdas');
  13. }
  14. c++
  15. }
  16. console.log('end');
  17. } catch (error) {
  18. console.log('catched!!!');
  19. }
  20.  
  21. }
  22.  
  23. start();
Add Comment
Please, Sign In to add comment