Created
October 10, 2017 12:05
-
-
Save deecewan/00594db6cf3d0b21b6356bc8b11fe7f9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(() => { | |
const myPromise = new Promise((res) => setTimeout(res, 10)); | |
myPromise | |
.then(() => { throw new Error('shit\'s fucked'); }) | |
.then(() => console.log('won\'t ever run')) | |
.catch(err => console.log('how is shit?', err)) | |
.then(() => console.log('will run')) | |
.then(() => { throw new Error('some other error'); }) | |
.then(() => console.log('won\'t run')) | |
.then(() => console.log('won\'t run')) | |
.catch((err) => { | |
if (err instanceof TypeError) { | |
// i can handle that | |
return console.log('typeerror', err); | |
} | |
throw err; | |
}) | |
.then(() => console.log('won\'t run')); | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment