Last active
April 14, 2017 12:19
-
-
Save jsocol/eb8c08e3002ba2daed0eecaffa371faf to your computer and use it in GitHub Desktop.
Revisions
-
jsocol revised this gist
Apr 14, 2017 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,17 +1,17 @@ // Logs 'rejected Error: sync error' const p = new Promise((resolve, reject) => { throw new Error('sync error'); }).then(null, e => console.log('rejected', e)); // q never settles, uncaught error const q = new Promise((resolve, reject) => { setImmediate(() => { throw new Error('async error'); }); }).then(null, e => console.log('rejected', e)); // r never settles, catch never executes try { const r = new Promise((resolve, reject) => { setImmediate(() => { throw new Error('async error'); }); }).then(null, e => console.log('rejected', e)); } catch (err) { console.log('caught', err); -
jsocol created this gist
Apr 14, 2017 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ // Logs 'rejected', 'sync error' const p = new Promise((resolve, reject) => { throw new Error('sync error'); }).then(null, e => console.log('rejected', e)); // q never settles, uncaught error const q = new Promise((resolve, reject) => { setTimeout(() => { throw new Error('async error'); }, 500); }).then(null, e => console.log('rejected', e)); // r never settles, catch never executes try { const r = new Promise((resolve, reject) => { setTimeout(() => { throw new Error('async error'); }, 500); }).then(null, e => console.log('rejected', e)); } catch (err) { console.log('caught', err); }