Created
April 10, 2011 08:56
-
-
Save aseemk/912167 to your computer and use it in GitHub Desktop.
Throwing an error synchronously within a closure isn't caught -- Streamline bug?
This file contains 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
console.log('will throw error in one second...'); | |
try { | |
// simulate async step here: | |
setTimeout(_, 1000); | |
// then *synchronously* throw error here: | |
(function closure() { | |
throw new Error(); | |
})(); | |
} catch (e) { | |
// this should kick in, no? it doesn't: | |
console.log('successfully received error!'); | |
} | |
console.log('did it get properly suppressed?'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment