mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-26 03:29:00 +01:00
#90218 Error handling
This commit is contained in:
@@ -3,12 +3,13 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { SyncStatus, SyncSource, IUserDataSyncService } from 'vs/platform/userDataSync/common/userDataSync';
|
||||
import { SyncStatus, SyncSource, IUserDataSyncService, UserDataSyncError } from 'vs/platform/userDataSync/common/userDataSync';
|
||||
import { ISharedProcessService } from 'vs/platform/ipc/electron-browser/sharedProcessService';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { Emitter, Event } from 'vs/base/common/event';
|
||||
import { IChannel } from 'vs/base/parts/ipc/common/ipc';
|
||||
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
|
||||
export class UserDataSyncService extends Disposable implements IUserDataSyncService {
|
||||
|
||||
@@ -30,7 +31,16 @@ export class UserDataSyncService extends Disposable implements IUserDataSyncServ
|
||||
@ISharedProcessService sharedProcessService: ISharedProcessService
|
||||
) {
|
||||
super();
|
||||
this.channel = sharedProcessService.getChannel('userDataSync');
|
||||
const userDataSyncChannel = sharedProcessService.getChannel('userDataSync');
|
||||
this.channel = {
|
||||
call<T>(command: string, arg?: any, cancellationToken?: CancellationToken): Promise<T> {
|
||||
return userDataSyncChannel.call(command, arg, cancellationToken)
|
||||
.then(null, error => { throw UserDataSyncError.toUserDataSyncError(error); });
|
||||
},
|
||||
listen<T>(event: string, arg?: any): Event<T> {
|
||||
return userDataSyncChannel.listen(event, arg);
|
||||
}
|
||||
};
|
||||
this.channel.call<SyncStatus>('_getInitialStatus').then(status => {
|
||||
this.updateStatus(status);
|
||||
this._register(this.channel.listen<SyncStatus>('onDidChangeStatus')(status => this.updateStatus(status)));
|
||||
|
||||
Reference in New Issue
Block a user