mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-30 01:25:38 -05:00
Merge from vscode 718331d6f3ebd1b571530ab499edb266ddd493d5
This commit is contained in:
@@ -124,22 +124,38 @@ export interface IUserData {
|
||||
}
|
||||
|
||||
export enum UserDataSyncErrorCode {
|
||||
TooLarge = 'TooLarge',
|
||||
Unauthroized = 'Unauthroized',
|
||||
Unauthorized = 'Unauthorized',
|
||||
Forbidden = 'Forbidden',
|
||||
ConnectionRefused = 'ConnectionRefused',
|
||||
Rejected = 'Rejected',
|
||||
TooLarge = 'TooLarge',
|
||||
NoRef = 'NoRef',
|
||||
NewLocal = 'NewLocal',
|
||||
Unknown = 'Unknown',
|
||||
TooManyFailures = 'TooManyFailures',
|
||||
ConnectionRefused = 'ConnectionRefused'
|
||||
}
|
||||
|
||||
export class UserDataSyncError extends Error {
|
||||
|
||||
constructor(message: string, public readonly code: UserDataSyncErrorCode, public readonly source?: SyncSource) {
|
||||
super(message);
|
||||
this.name = `${this.code} (UserDataSyncError) ${this.source}`;
|
||||
}
|
||||
|
||||
static toUserDataSyncError(error: Error): UserDataSyncError {
|
||||
if (error instanceof UserDataSyncStoreError) {
|
||||
return error;
|
||||
}
|
||||
const match = /^(.+) \(UserDataSyncError\) (.+)?$/.exec(error.name);
|
||||
if (match && match[1]) {
|
||||
return new UserDataSyncError(error.message, <UserDataSyncErrorCode>match[1], <SyncSource>match[2]);
|
||||
}
|
||||
return new UserDataSyncError(error.message, UserDataSyncErrorCode.Unknown);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export class UserDataSyncStoreError extends UserDataSyncError { }
|
||||
|
||||
export interface IUserDataSyncStore {
|
||||
url: string;
|
||||
authenticationProviderId: string;
|
||||
@@ -201,8 +217,8 @@ export interface ISynchroniser {
|
||||
|
||||
export interface IUserDataSynchroniser extends ISynchroniser {
|
||||
readonly source: SyncSource;
|
||||
getRemoteContent(): Promise<string | null>;
|
||||
resolveConflicts(content: string): Promise<void>;
|
||||
getRemoteContent(preivew?: boolean): Promise<string | null>;
|
||||
accept(content: string): Promise<void>;
|
||||
}
|
||||
|
||||
export const IUserDataSyncService = createDecorator<IUserDataSyncService>('IUserDataSyncService');
|
||||
@@ -212,14 +228,14 @@ export interface IUserDataSyncService extends ISynchroniser {
|
||||
isFirstTimeSyncAndHasUserData(): Promise<boolean>;
|
||||
reset(): Promise<void>;
|
||||
resetLocal(): Promise<void>;
|
||||
getRemoteContent(source: SyncSource): Promise<string | null>;
|
||||
resolveConflictsAndContinueSync(content: string): Promise<void>;
|
||||
getRemoteContent(source: SyncSource, preview: boolean): Promise<string | null>;
|
||||
accept(source: SyncSource, content: string): Promise<void>;
|
||||
}
|
||||
|
||||
export const IUserDataAutoSyncService = createDecorator<IUserDataAutoSyncService>('IUserDataAutoSyncService');
|
||||
export interface IUserDataAutoSyncService {
|
||||
_serviceBrand: any;
|
||||
onError: Event<{ code: UserDataSyncErrorCode, source?: SyncSource }>;
|
||||
readonly onError: Event<{ code: UserDataSyncErrorCode, source?: SyncSource }>;
|
||||
triggerAutoSync(): Promise<void>;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user