Skip to content

Instantly share code, notes, and snippets.

@aseemk
Created April 10, 2011 08:56
Show Gist options
  • Save aseemk/912167 to your computer and use it in GitHub Desktop.
Save aseemk/912167 to your computer and use it in GitHub Desktop.
Throwing an error synchronously within a closure isn't caught -- Streamline bug?
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