From c641a461acc8afbba6a014f70fb2e5df14b77bf1 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Wed, 31 Aug 2022 10:57:12 +0200 Subject: [PATCH] Fix `ignoreError()`. --- dist/cleanup/index.js | 15 +++++++++------ src/cleanup.ts | 16 ++++++++++------ 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/dist/cleanup/index.js b/dist/cleanup/index.js index 6e8116f..be777a4 100644 --- a/dist/cleanup/index.js +++ b/dist/cleanup/index.js @@ -67015,12 +67015,15 @@ function saveCache() { */ function ignoreError(promise) { return __awaiter(this, void 0, void 0, function* () { - try { - yield promise; - } - catch (error) { - core.warning(error); - } + /* eslint-disable github/no-then */ + return new Promise(resolve => { + promise + .catch(error => { + core.warning(error); + resolve(void 0); + }) + .then(resolve); + }); }); } function run() { diff --git a/src/cleanup.ts b/src/cleanup.ts index b385971..e8c7588 100644 --- a/src/cleanup.ts +++ b/src/cleanup.ts @@ -45,12 +45,16 @@ async function saveCache(): Promise { * @param promise the promise to ignore error from * @returns Promise that will ignore error reported by the given promise */ -async function ignoreError(promise: Promise): Promise { - try { - await promise - } catch (error) { - core.warning(error) - } +async function ignoreError(promise: Promise): Promise { + /* eslint-disable github/no-then */ + return new Promise(resolve => { + promise + .catch(error => { + core.warning(error) + resolve(void 0) + }) + .then(resolve) + }) } export async function run(): Promise {