UNPKG

@sussudio/platform

Version:

Internal APIs for VS Code's service injection the base services.

48 lines (47 loc) 2.34 kB
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { ErrorNoTelemetry } from '@sussudio/base/common/errors.mjs'; import { createDecorator } from '../../instantiation/common/instantiation.mjs'; export const IRemoteAuthorityResolverService = createDecorator('remoteAuthorityResolverService'); export var RemoteAuthorityResolverErrorCode; (function (RemoteAuthorityResolverErrorCode) { RemoteAuthorityResolverErrorCode['Unknown'] = 'Unknown'; RemoteAuthorityResolverErrorCode['NotAvailable'] = 'NotAvailable'; RemoteAuthorityResolverErrorCode['TemporarilyNotAvailable'] = 'TemporarilyNotAvailable'; RemoteAuthorityResolverErrorCode['NoResolverFound'] = 'NoResolverFound'; })(RemoteAuthorityResolverErrorCode || (RemoteAuthorityResolverErrorCode = {})); export class RemoteAuthorityResolverError extends ErrorNoTelemetry { static isNotAvailable(err) { return err instanceof RemoteAuthorityResolverError && err._code === RemoteAuthorityResolverErrorCode.NotAvailable; } static isTemporarilyNotAvailable(err) { return ( err instanceof RemoteAuthorityResolverError && err._code === RemoteAuthorityResolverErrorCode.TemporarilyNotAvailable ); } static isNoResolverFound(err) { return ( err instanceof RemoteAuthorityResolverError && err._code === RemoteAuthorityResolverErrorCode.NoResolverFound ); } static isHandled(err) { return err instanceof RemoteAuthorityResolverError && err.isHandled; } _message; _code; _detail; isHandled; constructor(message, code = RemoteAuthorityResolverErrorCode.Unknown, detail) { super(message); this._message = message; this._code = code; this._detail = detail; this.isHandled = code === RemoteAuthorityResolverErrorCode.NotAvailable && detail === true; // 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 Object.setPrototypeOf(this, RemoteAuthorityResolverError.prototype); } }