Merge from vscode 05fc61ffb1aee9fd19173c32113daed079f9b7bd (#5074)

* Merge from vscode 05fc61ffb1aee9fd19173c32113daed079f9b7bd

* fix tests
This commit is contained in:
Anthony Dresser
2019-04-16 22:11:30 -07:00
committed by GitHub
parent 2f8519cb6b
commit 8956b591f7
217 changed files with 5120 additions and 3926 deletions

View File

@@ -13,6 +13,49 @@ export interface ResolvedAuthority {
readonly port: number;
}
export enum RemoteAuthorityResolverErrorCode {
Unknown = 'Unknown',
NotAvailable = 'NotAvailable',
TemporarilyNotAvailable = 'TemporarilyNotAvailable',
}
export class RemoteAuthorityResolverError extends Error {
public static isHandledNotAvailable(err: any): boolean {
if (err instanceof RemoteAuthorityResolverError) {
if (err._code === RemoteAuthorityResolverErrorCode.NotAvailable && err._detail === true) {
return true;
}
}
return false;
}
public static isTemporarilyNotAvailable(err: any): boolean {
if (err instanceof RemoteAuthorityResolverError) {
return err._code === RemoteAuthorityResolverErrorCode.TemporarilyNotAvailable;
}
return false;
}
public readonly _message: string | undefined;
public readonly _code: RemoteAuthorityResolverErrorCode;
public readonly _detail: any;
constructor(message?: string, code: RemoteAuthorityResolverErrorCode = RemoteAuthorityResolverErrorCode.Unknown, detail?: any) {
super(message);
this._message = message;
this._code = code;
this._detail = detail;
// workaround when extending builtin objects and when compiling to ES5, see:
// https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work
if (typeof (<any>Object).setPrototypeOf === 'function') {
(<any>Object).setPrototypeOf(this, RemoteAuthorityResolverError.prototype);
}
}
}
export interface IRemoteAuthorityResolverService {
_serviceBrand: any;