Skip to content

Commit 5052630

Browse files
committed
Avoid notifying of failures for workspace builds.
- Notifications of failure aren't shown for project builds - Also standardizes based on approach of other extensions that use similar functionality in their UI elements Signed-off-by: Roland Grunberg <rgrunber@redhat.com>
1 parent 3064ea3 commit 5052630

File tree

1 file changed

+14
-18
lines changed

1 file changed

+14
-18
lines changed

src/standardLanguageClient.ts

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -499,22 +499,22 @@ export class StandardLanguageClient {
499499

500500
return window.withProgress({ location: ProgressLocation.Window }, async p => {
501501
p.report({ message: 'Rebuilding projects...' });
502-
return new Promise(async (resolve, reject) => {
503-
const start = new Date().getTime();
502+
const start = new Date().getTime();
504503

505-
let res: CompileWorkspaceStatus;
506-
try {
507-
res = token ? await this.languageClient.sendRequest(BuildProjectRequest.type, params, token) :
508-
await this.languageClient.sendRequest(BuildProjectRequest.type, params);
509-
} catch (error) {
510-
if (error && error.code === -32800) { // Check if the request is cancelled.
511-
res = CompileWorkspaceStatus.cancelled;
512-
}
513-
reject(error);
504+
let res: CompileWorkspaceStatus;
505+
try {
506+
res = token ? await this.languageClient.sendRequest(BuildProjectRequest.type, params, token) :
507+
await this.languageClient.sendRequest(BuildProjectRequest.type, params);
508+
} catch (error) {
509+
if (error && error.code === -32800) { // Check if the request is cancelled.
510+
res = CompileWorkspaceStatus.cancelled;
514511
}
512+
throw error;
513+
}
515514

516-
const elapsed = new Date().getTime() - start;
517-
const humanVisibleDelay = elapsed < 1000 ? 1000 : 0;
515+
const elapsed = new Date().getTime() - start;
516+
const humanVisibleDelay = elapsed < 1000 ? 1000 : 0;
517+
return new Promise(async (resolve, reject) => {
518518
setTimeout(() => { // set a timeout so user would still see the message when build time is short
519519
resolve(res);
520520
}, humanVisibleDelay);
@@ -546,11 +546,7 @@ export class StandardLanguageClient {
546546
const humanVisibleDelay = elapsed < 1000 ? 1000 : 0;
547547
return new Promise((resolve, reject) => {
548548
setTimeout(() => { // set a timeout so user would still see the message when build time is short
549-
if (res === CompileWorkspaceStatus.succeed) {
550-
resolve(res);
551-
} else {
552-
reject(res);
553-
}
549+
resolve(res);
554550
}, humanVisibleDelay);
555551
});
556552
});

0 commit comments

Comments
 (0)