提交 ad362089 编写于 作者: J Johannes Rieken

add proposal of CancellationError, https://github.com/microsoft/vscode/issues/93686

上级 d5a632e6
......@@ -142,6 +142,15 @@ export function isPromiseCanceledError(error: any): boolean {
return error instanceof Error && error.name === canceledName && error.message === canceledName;
}
// !!!IMPORTANT!!!
// Do NOT change this class because it is also used as an API-type.
export class CancellationError extends Error {
constructor() {
super(canceledName);
this.name = this.message;
}
}
/**
* Returns an error that signals cancellation.
*/
......
......@@ -18,6 +18,25 @@ import { Command } from 'vscode';
declare module 'vscode' {
//#region https://github.com/microsoft/vscode/issues/93686
/**
* An error type should be used to signal cancellation of an operation.
*
* This type can be used in response to a cancellation token or when an
* operation is being cancelled by the executor of that operation.
*/
export class CancellationError extends Error {
/**
* Creates a new cancellation error.
*/
constructor();
}
//#endregion
// #region auth provider: https://github.com/microsoft/vscode/issues/88309
/**
......
......@@ -1212,6 +1212,9 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
ViewColumn: extHostTypes.ViewColumn,
WorkspaceEdit: extHostTypes.WorkspaceEdit,
// proposed api types
get CancellationError() {
return errors.CancellationError;
},
get RemoteAuthorityResolverError() {
// checkProposedApiEnabled(extension);
return extHostTypes.RemoteAuthorityResolverError;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册