Guest User

Untitled

a guest
Apr 26th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. const shouldReturnPromise = () => { throw "test"; }
  2.  
  3. const withAsyncAwait = async () => {
  4. try {
  5. await shouldReturnPromise()
  6. } catch (e) {
  7. console.log('Handled: ' + e)
  8. }
  9. }
  10.  
  11. const withPromise = async () => {
  12. shouldReturnPromise().then(null, () => console.log('Not Handled!'));
  13. }
  14.  
  15. console.log(withAsyncAwait());
  16. console.log(withPromise());
Add Comment
Please, Sign In to add comment