From 53dbc453dc30c7eea1462e4bccdd6428edf663bc Mon Sep 17 00:00:00 2001 From: denihs Date: Thu, 6 Apr 2023 18:19:50 -0400 Subject: [PATCH] Revert "- fix test: throw error when _runApp fails" This reverts commit 17d2496c1b680ee8759db31f4aa6225009bb0ca5. --- tools/cli/commands.js | 1 + tools/runners/run-app.js | 1 - tools/utils/buildmessage.js | 12 +++++++++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/tools/cli/commands.js b/tools/cli/commands.js index 2aaad1708b..d0cd3c1f39 100644 --- a/tools/cli/commands.js +++ b/tools/cli/commands.js @@ -424,6 +424,7 @@ async function doRunCommand(options) { import { CordovaProject } from '../cordova/project.js'; await main.captureAndExit('', 'preparing Cordova project', async () => { + // TODO -> Have to change CordovaProject constructor here. const cordovaProject = new CordovaProject(projectContext, { settingsFile: options.settings, mobileServerUrl: utils.formatUrl(parsedMobileServerUrl), diff --git a/tools/runners/run-app.js b/tools/runners/run-app.js index 1dfa5b2755..40d9d2de01 100644 --- a/tools/runners/run-app.js +++ b/tools/runners/run-app.js @@ -408,7 +408,6 @@ Object.assign(AppRunner.prototype, { await self._runApp(); } catch (e) { self._resolvePromise("start", e); - throw e; } finally { await self.startPromise; self.startPromise = null; diff --git a/tools/utils/buildmessage.js b/tools/utils/buildmessage.js index 18b7f1459a..3df1b206ce 100644 --- a/tools/utils/buildmessage.js +++ b/tools/utils/buildmessage.js @@ -279,7 +279,17 @@ async function capture(options, f) { } try { - await f(); + // you can think that this is as simple as: + // await f(); + // but we need to make sure that we are not leaking a thrown error + // the next call to capture. + await new Promise(async (resolve) => { + try { + await f(); + } finally { + resolve(); + } + }); } finally { progress.reportProgressDone();