Skip to content

Instantly share code, notes, and snippets.

@gskachkov
Last active July 28, 2017 09:06
Show Gist options
  • Save gskachkov/6f2b875cd97a771e4333f99a9cdaf3f3 to your computer and use it in GitHub Desktop.
Save gskachkov/6f2b875cd97a771e4333f99a9cdaf3f3 to your computer and use it in GitHub Desktop.
var asyncThrow = async () => { throw new Error('Rejected-value') };
var reject = async () => Promise.reject('Rejected-value');
var foo = async () => {
try {
await asyncThrow();
} catch (e) {
console.log('Catched error:', e);
}
try {
await reject();
} catch (e) {
console.log('Catched error:', e);
}
};
foo();
// Catched error: Error: Rejected-value
// ....
// Catched error:Rejected-value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment