Skip to content

Commit afa3252

Browse files
committed
Fixes #1432: Stops throwing for cancelled promise
1 parent dd6acb0 commit afa3252

File tree

4 files changed

+5
-23
lines changed

4 files changed

+5
-23
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
1313

1414
### Fixed
1515

16+
- Fixes [#1432](https://github.com/eamodio/vscode-gitlens/issues/1432) - Unhandled Timeout Promise
1617
- Fixes [#1562](https://github.com/eamodio/vscode-gitlens/issues/1562) - Yarn audit fails with 2 high sev vulnerabilities (dev dependencies only) — thanks to [PR #1563](https://github.com/eamodio/vscode-gitlens/pull/1563) by Ivan Volzhev ([@ivolzhevbt](https://github.com/ivolzhevbt))
1718
- Fixes [#1566](https://github.com/eamodio/vscode-gitlens/issues/1566) - Bug: unable to open 'pr.url' when clicking PR link
1819
- Fixes [#1545](https://github.com/eamodio/vscode-gitlens/issues/1545) - Missing branch comparison controls in versions 11.5.0 and 11.5.1

src/hovers/hovers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ export namespace Hovers {
193193
commit.isUncommitted ? commit.getPreviousLineDiffUris(uri, editorLine, uri.sha) : undefined,
194194
getAutoLinkedIssuesOrPullRequests(commit.message, remotes),
195195
getPullRequestForCommit(commit.ref, remotes),
196-
Container.vsls.maybeGetPresence(commit.email).catch(() => undefined),
196+
Container.vsls.maybeGetPresence(commit.email),
197197
]);
198198

199199
const details = await CommitFormatter.fromTemplateAsync(Container.config.hovers.detailsMarkdownFormat, commit, {

src/system/decorators/timeout.ts

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
'use strict';
2-
import { CancellationError, is as isPromise } from '../promise';
2+
import { cancellable, is as isPromise } from '../promise';
33

44
export function timeout(timeout: number): any;
55
export function timeout(timeoutFromLastArg: true, defaultTimeout?: number): any;
@@ -32,26 +32,7 @@ export function timeout(timeoutOrTimeoutFromLastArg: number | boolean, defaultTi
3232
const result = fn?.apply(this, args);
3333
if (timeout == null || timeout < 1 || !isPromise(result)) return result;
3434

35-
// const cc = Logger.getCorrelationContext();
36-
37-
// const start = process.hrtime();
38-
39-
return Promise.race([
40-
result,
41-
// result.then(r => {
42-
// Logger.debug(
43-
// cc,
44-
// `${GlyphChars.Dash} timed out, but completed after ${Strings.getDurationMilliseconds(start)} ms`
45-
// );
46-
// return r;
47-
// }),
48-
new Promise((_, reject) => {
49-
const id = setTimeout(() => {
50-
clearTimeout(id);
51-
reject(new CancellationError(result, `Timed out after ${timeout} ms`));
52-
}, timeout);
53-
}),
54-
]);
35+
return cancellable(result, timeout, { onDidCancel: resolve => resolve(undefined) });
5536
};
5637
};
5738
}

src/views/nodes/contributorsNode.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export class ContributorsNode extends ViewNode<ContributorsView | RepositoriesVi
5555
if (contributors.length === 0) return [new MessageNode(this.view, this, 'No contributors could be found.')];
5656

5757
GitContributor.sort(contributors);
58-
const presenceMap = await this.maybeGetPresenceMap(contributors).catch(() => undefined);
58+
const presenceMap = await this.maybeGetPresenceMap(contributors);
5959

6060
this._children = contributors.map(
6161
c => new ContributorNode(this.uri, this.view, this, c, { all: all, ref: ref, presence: presenceMap }),

0 commit comments

Comments
 (0)