From 47404946252ad38f11818fd7034f46210503a781 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Brunner?= Date: Tue, 3 Sep 2024 16:46:25 +0200 Subject: [PATCH] Don't hide error, no error loop --- buildtools/check-example.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/buildtools/check-example.js b/buildtools/check-example.js index 8567b94de117..a0be181082c2 100644 --- a/buildtools/check-example.js +++ b/buildtools/check-example.js @@ -61,10 +61,13 @@ const OSMImage = fileMock('osm.png', 'image/png'); const ASITVDCapabilities = fileMock('asitvd.capabilities.xml', 'text/xml'); const SgxCapabilities = fileMock('sgx.capabilities.xml', 'text/xml'); let browser; +let browserClosed = false; -process.on('unhandledRejection', async (error) => { - console.log(`UnhandledRejection: ${error.message}.`); - await browser.close(); +process.on('unhandledRejection', async (reason, promise) => { + console.log('UnhandledRejection: ', promise, 'reason:', reason); + if (browser && !browserClosed) { + await browser.close(); + } process.exit(2); });