From 21bea8c8674a3f3fc7ae1908c371270cf444cc77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Jerna=C5=9B?= Date: Tue, 6 Feb 2024 15:50:29 +0100 Subject: [PATCH 1/2] Log multiple errors # What Log AggregateError type, when multiple errors are returned from HTTP client - fixes #174 # Why We would silently fail otherwise as error.message was empty for the AggregatedError exception. --- dist/index.js | 8 +++++++- src/main.ts | 7 ++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index 74be01a..3c88aad 100644 --- a/dist/index.js +++ b/dist/index.js @@ -28027,7 +28027,13 @@ async function run() { } } catch (error) { - if (error instanceof Error) { + if (error instanceof AggregateError) { + core.setFailed(`Multiple errors returned`); + for (const err of error.errors) { + core.error(`Error ${error.errors.indexOf(err)}: ${err.message}`); + } + } + else if (error instanceof Error) { core.setFailed(error.message); } else { diff --git a/src/main.ts b/src/main.ts index 98096e4..041a3d4 100644 --- a/src/main.ts +++ b/src/main.ts @@ -25,7 +25,12 @@ export async function run(): Promise { } } } catch (error) { - if (error instanceof Error) { + if (error instanceof AggregateError) { + core.setFailed(`Multiple errors returned`) + for (const err of error.errors) { + core.error(`Error ${error.errors.indexOf(err)}: ${err.message}`) + } + } else if (error instanceof Error) { core.setFailed(error.message) } else { core.setFailed(`Unknown object was thrown: ${error}`) From a494d935f4b56874c4a5a87d19af7afcf3a163d0 Mon Sep 17 00:00:00 2001 From: daz Date: Tue, 6 Feb 2024 08:24:05 -0700 Subject: [PATCH 2/2] Check dist on release branches --- .github/workflows/check-dist.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/check-dist.yml b/.github/workflows/check-dist.yml index 68f03b5..6b85a10 100644 --- a/.github/workflows/check-dist.yml +++ b/.github/workflows/check-dist.yml @@ -9,6 +9,7 @@ on: push: branches: - main + - releases/** paths-ignore: - '**.md' pull_request: