mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-26 03:29:00 +01:00
Always reject Promises with Error instances
This commit is contained in:
@@ -31,13 +31,13 @@ export class MainThreadDebugService extends MainThreadDebugServiceShape {
|
||||
|
||||
public $createDebugSession(configuration: IConfig): TPromise<DebugSessionUUID> {
|
||||
if (configuration.request !== 'launch' && configuration.request !== 'attach') {
|
||||
return TPromise.wrapError(`only 'launch' or 'attach' allowed for 'request' attribute`);
|
||||
return TPromise.wrapError(new Error(`only 'launch' or 'attach' allowed for 'request' attribute`));
|
||||
}
|
||||
return this.debugService.createProcess(configuration).then(process => {
|
||||
if (process) {
|
||||
return <DebugSessionUUID>process.getId();
|
||||
}
|
||||
return TPromise.wrapError('cannot create debug session');
|
||||
return TPromise.wrapError(new Error('cannot create debug session'));
|
||||
}, err => {
|
||||
return TPromise.wrapError(err && err.message ? err.message : 'cannot create debug session');
|
||||
});
|
||||
@@ -50,11 +50,11 @@ export class MainThreadDebugService extends MainThreadDebugServiceShape {
|
||||
if (response.success) {
|
||||
return response.body;
|
||||
} else {
|
||||
return TPromise.wrapError(response.message);
|
||||
return TPromise.wrapError(new Error(response.message));
|
||||
}
|
||||
});
|
||||
}
|
||||
return TPromise.wrapError('debug session not found');
|
||||
return TPromise.wrapError(new Error('debug session not found'));
|
||||
}
|
||||
|
||||
private _findProcessByUUID(processId: DebugSessionUUID): IProcess | null {
|
||||
|
||||
Reference in New Issue
Block a user