mirror of
https://github.com/microsoft/vscode.git
synced 2026-02-15 07:28:05 +00:00
Replace the deprecated canceled with Cancellation Error. (#197605)
Signed-off-by: Shubh <shubhisroking@gmail.com>
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
|
||||
import { range } from 'vs/base/common/arrays';
|
||||
import { CancellationToken, CancellationTokenSource } from 'vs/base/common/cancellation';
|
||||
import { canceled } from 'vs/base/common/errors';
|
||||
import { CancellationError } from 'vs/base/common/errors';
|
||||
|
||||
/**
|
||||
* A Pager is a stateless abstraction over a paged collection.
|
||||
@@ -91,7 +91,7 @@ export class PagedModel<T> implements IPagedModel<T> {
|
||||
|
||||
resolve(index: number, cancellationToken: CancellationToken): Promise<T> {
|
||||
if (cancellationToken.isCancellationRequested) {
|
||||
return Promise.reject(canceled());
|
||||
return Promise.reject(new CancellationError());
|
||||
}
|
||||
|
||||
const pageIndex = Math.floor(index / this.pager.pageSize);
|
||||
@@ -154,12 +154,12 @@ export class DelayedPagedModel<T> implements IPagedModel<T> {
|
||||
resolve(index: number, cancellationToken: CancellationToken): Promise<T> {
|
||||
return new Promise((c, e) => {
|
||||
if (cancellationToken.isCancellationRequested) {
|
||||
return e(canceled());
|
||||
return e(new CancellationError());
|
||||
}
|
||||
|
||||
const timer = setTimeout(() => {
|
||||
if (cancellationToken.isCancellationRequested) {
|
||||
return e(canceled());
|
||||
return e(new CancellationError());
|
||||
}
|
||||
|
||||
timeoutCancellation.dispose();
|
||||
@@ -169,7 +169,7 @@ export class DelayedPagedModel<T> implements IPagedModel<T> {
|
||||
const timeoutCancellation = cancellationToken.onCancellationRequested(() => {
|
||||
clearTimeout(timer);
|
||||
timeoutCancellation.dispose();
|
||||
e(canceled());
|
||||
e(new CancellationError());
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user