Skip to content

Commit 3d849e9

Browse files
committed
Include underlying error in error message
1 parent c8fb403 commit 3d849e9

File tree

6 files changed

+23
-10
lines changed

6 files changed

+23
-10
lines changed

Diff for: lib/init.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: lib/init.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: lib/init.test.js

+6-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: lib/init.test.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: src/init.test.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -108,17 +108,22 @@ for (const { runnerEnv, ErrorConstructor, message } of [
108108
);
109109
fs.writeFileSync(fileToCleanUp, "");
110110

111+
const rmSyncError = `Failed to clean up file ${fileToCleanUp}`;
112+
111113
const messages: LoggedMessage[] = [];
112114
t.throws(
113115
() =>
114116
cleanupDatabaseClusterDirectory(
115117
createTestConfig({ dbLocation }),
116118
getRecordingLogger(messages),
117119
() => {
118-
throw new Error("Failed to clean up");
120+
throw new Error(rmSyncError);
119121
},
120122
),
121-
{ instanceOf: ErrorConstructor, message: message(dbLocation) },
123+
{
124+
instanceOf: ErrorConstructor,
125+
message: `${message(dbLocation)} Details: ${rmSyncError}`,
126+
},
122127
);
123128

124129
t.is(messages.length, 1);

Diff for: src/init.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -210,13 +210,17 @@ export function cleanupDatabaseClusterDirectory(
210210
if (isSelfHostedRunner()) {
211211
throw new util.ConfigurationError(
212212
`${blurb} This can happen if another process is using the directory or the directory is owned by a different user. ` +
213-
"Please clean up the directory manually and rerun the job.",
213+
`Please clean up the directory manually and rerun the job. Details: ${
214+
util.wrapError(e).message
215+
}`,
214216
);
215217
} else {
216218
throw new Error(
217219
`${blurb} This shouldn't typically happen on hosted runners. ` +
218220
"If you are using an advanced setup, please check your workflow, otherwise we " +
219-
"recommend rerunning the job.",
221+
`recommend rerunning the job. Details: ${
222+
util.wrapError(e).message
223+
}`,
220224
);
221225
}
222226
}

0 commit comments

Comments
 (0)