mirror of
https://github.com/coder/code-server.git
synced 2026-06-22 01:47:10 +02:00
chore(vscode): update to 1.54.2
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IAction } from 'vs/base/common/actions';
|
||||
|
||||
export interface ErrorListenerCallback {
|
||||
(error: any): void;
|
||||
}
|
||||
@@ -221,3 +223,31 @@ export class NotSupportedError extends Error {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class ExpectedError extends Error {
|
||||
readonly isExpected = true;
|
||||
}
|
||||
|
||||
export interface IErrorOptions {
|
||||
actions?: ReadonlyArray<IAction>;
|
||||
}
|
||||
|
||||
export interface IErrorWithActions {
|
||||
actions?: ReadonlyArray<IAction>;
|
||||
}
|
||||
|
||||
export function isErrorWithActions(obj: unknown): obj is IErrorWithActions {
|
||||
const candidate = obj as IErrorWithActions | undefined;
|
||||
|
||||
return candidate instanceof Error && Array.isArray(candidate.actions);
|
||||
}
|
||||
|
||||
export function createErrorWithActions(message: string, options: IErrorOptions = Object.create(null)): Error & IErrorWithActions {
|
||||
const result = new Error(message);
|
||||
|
||||
if (options.actions) {
|
||||
(result as IErrorWithActions).actions = options.actions;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user