Advertisement
Guest User

Untitled

a guest
Oct 19th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. const Bluebird = require('bluebird')
  2.  
  3. async function asyncFunction() {
  4. return Bluebird.resolve(42)
  5. }
  6.  
  7. function notAsyncFunction() {
  8. return Bluebird.resolve(42)
  9. }
  10.  
  11. // will throw
  12. try {
  13. asyncFunction().tap()
  14. } catch(e) {
  15. console.log('Async version threw')
  16. }
  17.  
  18. // will not throw
  19. try {
  20. notAsyncFunction().tap()
  21. console.log('NotAsync didnt throw')
  22. } catch(e) {
  23. console.log('This message will never be displayed')
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement