20219: Log with level error and with promise rejection reason when polling fails
authorStephen Smith <stephen@curii.com>
Thu, 3 Aug 2023 15:36:14 +0000 (11:36 -0400)
committerStephen Smith <stephen@curii.com>
Thu, 3 Aug 2023 15:36:14 +0000 (11:36 -0400)
Arvados-DCO-1.1-Signed-off-by: Stephen Smith <stephen@curii.com>

src/store/process-logs-panel/process-logs-panel-actions.ts

index 383de53d289dc6d6f4e5ebac1b3921708734a495..781c8903738280338d5271dbd4c82eb681d42a5d 100644 (file)
@@ -102,7 +102,7 @@ export const pollProcessLogs = (processUuid: string) =>
             return Promise.resolve();
         } catch (e) {
             // Remove log when polling error is handled in some way instead of being ignored
-            console.log("Polling process logs failed");
+            console.error("Error occurred in pollProcessLogs:", e);
             return Promise.reject();
         }
     };
@@ -144,7 +144,10 @@ const loadContainerLogFileContents = async (logFilesWithProgress: FileWithProgre
         if (res.length && res.every(promiseResult => (promiseResult.status === 'rejected'))) {
             // Since allSettled does not pass promise rejection we throw an
             //   error if every request failed
-            return Promise.reject("Failed to load logs");
+            const error = res.find(
+                (promiseResult): promiseResult is PromiseRejectedResult => promiseResult.status === 'rejected'
+              )?.reason;
+            return Promise.reject(error);
         }
         return res.filter((promiseResult): promiseResult is PromiseFulfilledResult<LogFragment[]> => (
             // Filter out log files with rejected promises