From 6ed532cb0d2251b6aa931b93ef28ee36e6c5b421 Mon Sep 17 00:00:00 2001 From: Akos Kitta Date: Wed, 5 Oct 2022 15:27:29 +0200 Subject: [PATCH] Avoid using `reportResult` if installing lib/core Closes #1529 Signed-off-by: Akos Kitta --- .../src/node/core-client-provider.ts | 2 +- arduino-ide-extension/src/node/grpc-progressible.ts | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/arduino-ide-extension/src/node/core-client-provider.ts b/arduino-ide-extension/src/node/core-client-provider.ts index 1686be1be..bb1251103 100644 --- a/arduino-ide-extension/src/node/core-client-provider.ts +++ b/arduino-ide-extension/src/node/core-client-provider.ts @@ -370,8 +370,8 @@ export class CoreClientProvider { ); progressHandler?.reportProgress(message); }, - reportResult: (result) => progressHandler?.reportResult(result), }, + reportResult: (result) => progressHandler?.reportResult(result), progressId, }) ) diff --git a/arduino-ide-extension/src/node/grpc-progressible.ts b/arduino-ide-extension/src/node/grpc-progressible.ts index edd04cd85..7b131f0f2 100644 --- a/arduino-ide-extension/src/node/grpc-progressible.ts +++ b/arduino-ide-extension/src/node/grpc-progressible.ts @@ -163,14 +163,17 @@ export namespace ExecuteWithProgress { * _unknown_ progress if falsy. */ readonly progressId?: string; - readonly responseService: Partial< - ResponseService & { reportResult: (result: DownloadResult) => void } - >; + readonly responseService: Partial; + /** + * It's only relevant for index updates to build a summary of possible client (4xx) and server (5xx) errors when downloading the files during the index update. It's missing for lib/platform installations. + */ + readonly reportResult?: (result: DownloadResult) => void; } export function createDataCallback({ responseService, progressId, + reportResult, }: ExecuteWithProgress.Options): (response: R) => void { const uuid = v4(); let message = ''; @@ -252,8 +255,8 @@ export namespace ExecuteWithProgress { }); } } else if (phase instanceof DownloadProgressEnd) { - if (url) { - responseService.reportResult?.({ + if (url && reportResult) { + reportResult({ url, message: phase.getMessage(), success: phase.getSuccess(),