Always reject Promises with Error instances

This commit is contained in:
Felix Becker
2017-06-19 19:35:58 +02:00
parent d0a6cc2715
commit dbe0f89264
63 changed files with 207 additions and 236 deletions

View File

@@ -104,7 +104,7 @@ export class ExtHostCommands extends ExtHostCommandsShape {
$executeContributedCommand<T>(id: string, ...args: any[]): Thenable<T> {
let command = this._commands.get(id);
if (!command) {
return TPromise.wrapError<T>(`Contributed command '${id}' does not exist.`);
return TPromise.wrapError<T>(new Error(`Contributed command '${id}' does not exist.`));
}
let { callback, thisArg, description } = command;
@@ -114,7 +114,7 @@ export class ExtHostCommands extends ExtHostCommandsShape {
try {
validateConstraint(args[i], description.args[i].constraint);
} catch (err) {
return TPromise.wrapError<T>(`Running the contributed command:'${id}' failed. Illegal argument '${description.args[i].name}' - ${description.args[i].description}`);
return TPromise.wrapError<T>(new Error(`Running the contributed command:'${id}' failed. Illegal argument '${description.args[i].name}' - ${description.args[i].description}`));
}
}
}
@@ -131,7 +131,7 @@ export class ExtHostCommands extends ExtHostCommandsShape {
// } catch (err) {
// //
// }
return TPromise.wrapError<T>(`Running the contributed command:'${id}' failed.`);
return TPromise.wrapError<T>(new Error(`Running the contributed command:'${id}' failed.`));
}
}