From 3d849e9df215507dcc28f48bfdf79732674e387b Mon Sep 17 00:00:00 2001 From: Henry Mercer Date: Wed, 12 Jun 2024 13:44:04 +0100 Subject: [PATCH] Include underlying error in error message --- lib/init.js | 4 ++-- lib/init.js.map | 2 +- lib/init.test.js | 8 ++++++-- lib/init.test.js.map | 2 +- src/init.test.ts | 9 +++++++-- src/init.ts | 8 ++++++-- 6 files changed, 23 insertions(+), 10 deletions(-) diff --git a/lib/init.js b/lib/init.js index 811bc41a5b..8b9279a131 100644 --- a/lib/init.js +++ b/lib/init.js @@ -137,12 +137,12 @@ rmSync = fs.rmSync) { // Hosted runners are automatically cleaned up, so this error should not occur for hosted runners. if ((0, actions_util_1.isSelfHostedRunner)()) { throw new util.ConfigurationError(`${blurb} This can happen if another process is using the directory or the directory is owned by a different user. ` + - "Please clean up the directory manually and rerun the job."); + `Please clean up the directory manually and rerun the job. Details: ${util.wrapError(e).message}`); } else { throw new Error(`${blurb} This shouldn't typically happen on hosted runners. ` + "If you are using an advanced setup, please check your workflow, otherwise we " + - "recommend rerunning the job."); + `recommend rerunning the job. Details: ${util.wrapError(e).message}`); } } } diff --git a/lib/init.js.map b/lib/init.js.map index 4bf41f1c42..662b25b96b 100644 --- a/lib/init.js.map +++ b/lib/init.js.map @@ -1 +1 @@ -{"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAE7B,6DAA+C;AAC/C,yEAA2D;AAC3D,kEAAoD;AAEpD,iDAAsE;AAEtE,qCAA+C;AAC/C,4DAA8C;AAE9C,2CAA0D;AAG1D,qDAAgD;AAChD,mDAAwE;AACxE,6CAA+B;AAExB,KAAK,UAAU,UAAU,CAC9B,UAA8B,EAC9B,UAA4B,EAC5B,OAAe,EACf,OAA2B,EAC3B,iBAA2C,EAC3C,MAAc;IAOd,MAAM,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC;IACxC,M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CAAC,kCAAkC,MAAM,CAAC,UAAU,IAAI;oBACvD,yEACN,iEAAiE,CAAC;YAElE,kGAAkG;YAClG,IAAI,IAAA,iCAAkB,GAAE,EAAE,CAAC;gBACzB,MAAM,IAAI,IAAI,CAAC,kBAAkB,CAC/B,GAAG,KAAK,4GAA4G;oBAClH,sEACE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,OACpB,EAAE,CACL,CAAC;YACJ,CAAC;iBAAM,CAAC;gBACN,MAAM,IAAI,KAAK,CACb,GAAG,KAAK,sDAAsD;oBAC5D,+EAA+E;oBAC/E,yCACE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,OACpB,EAAE,CACL,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC;AApDD,0EAoDC"} \ No newline at end of file diff --git a/lib/init.test.js b/lib/init.test.js index 02a751ac38..f022e22f3a 100644 --- a/lib/init.test.js +++ b/lib/init.test.js @@ -93,10 +93,14 @@ for (const { runnerEnv, ErrorConstructor, message } of [ fs.mkdirSync(dbLocation, { recursive: true }); const fileToCleanUp = path_1.default.resolve(dbLocation, "something-to-cleanup.txt"); fs.writeFileSync(fileToCleanUp, ""); + const rmSyncError = `Failed to clean up file ${fileToCleanUp}`; const messages = []; t.throws(() => (0, init_1.cleanupDatabaseClusterDirectory)((0, testing_utils_1.createTestConfig)({ dbLocation }), (0, testing_utils_1.getRecordingLogger)(messages), () => { - throw new Error("Failed to clean up"); - }), { instanceOf: ErrorConstructor, message: message(dbLocation) }); + throw new Error(rmSyncError); + }), { + instanceOf: ErrorConstructor, + message: `${message(dbLocation)} Details: ${rmSyncError}`, + }); t.is(messages.length, 1); t.is(messages[0].type, "warning"); t.is(messages[0].message, `The database cluster directory ${dbLocation} must be empty. Attempting to clean it up.`); diff --git a/lib/init.test.js.map b/lib/init.test.js.map index 90ec3efff0..eb03f62f1a 100644 --- a/lib/init.test.js.map +++ b/lib/init.test.js.map @@ -1 +1 @@ -{"version":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AAC,QAAQ,CAAC,EAC5B,GAAG,EAAE;gBACH,MAAM,IAAI,KAAK,CAAC,WAAW,CAAC,CAAC;YAC/B,CAAC,CACF,EACH;gBACE,UAAU,EAAE,gBAAgB;gBAC5B,OAAO,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC,aAAa,WAAW,EAAE;aAC1D,CACF,CAAC;YAEF,CAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;YACzB,CAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;YAClC,CAAC,CAAC,EAAE,CACF,QAAQ,CAAC,CAAC,CAAC,CAAC,OAAO,EACnB,kCAAkC,UAAU,4CAA4C,CACzF,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"} \ No newline at end of file diff --git a/src/init.test.ts b/src/init.test.ts index 6177f25f1c..213f4aff13 100644 --- a/src/init.test.ts +++ b/src/init.test.ts @@ -108,6 +108,8 @@ for (const { runnerEnv, ErrorConstructor, message } of [ ); fs.writeFileSync(fileToCleanUp, ""); + const rmSyncError = `Failed to clean up file ${fileToCleanUp}`; + const messages: LoggedMessage[] = []; t.throws( () => @@ -115,10 +117,13 @@ for (const { runnerEnv, ErrorConstructor, message } of [ createTestConfig({ dbLocation }), getRecordingLogger(messages), () => { - throw new Error("Failed to clean up"); + throw new Error(rmSyncError); }, ), - { instanceOf: ErrorConstructor, message: message(dbLocation) }, + { + instanceOf: ErrorConstructor, + message: `${message(dbLocation)} Details: ${rmSyncError}`, + }, ); t.is(messages.length, 1); diff --git a/src/init.ts b/src/init.ts index 59e52bf753..35e5228b1f 100644 --- a/src/init.ts +++ b/src/init.ts @@ -210,13 +210,17 @@ export function cleanupDatabaseClusterDirectory( if (isSelfHostedRunner()) { throw new util.ConfigurationError( `${blurb} This can happen if another process is using the directory or the directory is owned by a different user. ` + - "Please clean up the directory manually and rerun the job.", + `Please clean up the directory manually and rerun the job. Details: ${ + util.wrapError(e).message + }`, ); } else { throw new Error( `${blurb} This shouldn't typically happen on hosted runners. ` + "If you are using an advanced setup, please check your workflow, otherwise we " + - "recommend rerunning the job.", + `recommend rerunning the job. Details: ${ + util.wrapError(e).message + }`, ); } }