From a2155572b985ecce6e42148eba9f354c53188ec1 Mon Sep 17 00:00:00 2001 From: Dmitry Shibanov Date: Mon, 8 Nov 2021 14:22:04 +0300 Subject: [PATCH] add warning for a step level --- dist/cache-save/index.js | 7 +++++++ src/cache-save.ts | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/dist/cache-save/index.js b/dist/cache-save/index.js index 4d22ce3c3..46320da7e 100644 --- a/dist/cache-save/index.js +++ b/dist/cache-save/index.js @@ -51451,6 +51451,13 @@ const cache = __importStar(__webpack_require__(692)); const fs_1 = __importDefault(__webpack_require__(747)); const constants_1 = __webpack_require__(196); const cache_utils_1 = __webpack_require__(143); +// Catch and log any unhandled exceptions. These exceptions can leak out of the uploadChunk method in +// @actions/toolkit when a failed upload closes the file descriptor causing any in-process reads to +// throw an uncaught exception. Instead of failing this action, just warn. +process.on('uncaughtException', e => { + const warningPrefix = '[warning]'; + core.info(`${warningPrefix}${e.message}`); +}); function run() { return __awaiter(this, void 0, void 0, function* () { try { diff --git a/src/cache-save.ts b/src/cache-save.ts index 9fb0b29d6..34115559b 100644 --- a/src/cache-save.ts +++ b/src/cache-save.ts @@ -4,6 +4,14 @@ import fs from 'fs'; import {State} from './constants'; import {getCacheDirectoryPath, getPackageManagerInfo} from './cache-utils'; +// Catch and log any unhandled exceptions. These exceptions can leak out of the uploadChunk method in +// @actions/toolkit when a failed upload closes the file descriptor causing any in-process reads to +// throw an uncaught exception. Instead of failing this action, just warn. +process.on('uncaughtException', e => { + const warningPrefix = '[warning]'; + core.info(`${warningPrefix}${e.message}`); +}); + export async function run() { try { const cacheLock = core.getInput('cache');