-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: LS: Refactoringse.g. extract to constant or function, rename symbole.g. extract to constant or function, rename symbolFix AvailableA PR has been opened for this issueA PR has been opened for this issue
Milestone
Description
From @MikeyBurkman on October 8, 2018 21:37
- VSCode Version: 1.28.0
- OS Version: OSX High Sierra
Steps to Reproduce:
- The code in the gif on https://code.visualstudio.com/updates/v1_28#_convert-to-async-function is actually wrong
- When doing
.then(fn1, fn2), the second argfn2should NOT be called if there's an error infn1.
Sample code:
'use strict';
const promise = () => new Promise((res) => setTimeout(res, 500));
const fSync = function() {
return promise().then(
() => {
throw new Error('Failure!');
},
() => null
);
};
// This function was created by copying/pasting the above function, and applying the "convert to async function" helper
const fAsync = async function() {
try {
await promise();
throw new Error('Failure!');
} catch (e) {
return null;
}
};
fSync()
.then(() => console.log('SYNC Sucess?'))
.catch((err) => console.log('SYNC Got an error', err));
fAsync()
.then(() => console.log('ASYNC Sucess?'))
.catch((err) => console.log('ASYNC Got an error', err));Expected output:
- Both should output "[A]SYNC Got an error Error: Failure!"
Actual output:
- SYNC Got an error Error: Failure!
- ASYNC Success?
Copied from original issue: microsoft/vscode#60201
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: LS: Refactoringse.g. extract to constant or function, rename symbole.g. extract to constant or function, rename symbolFix AvailableA PR has been opened for this issueA PR has been opened for this issue