Skip to content

Commit 26c6f91

Browse files
committed
Throw if aborted config functions are called incorrectly
1 parent e3aeabd commit 26c6f91

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

‎lib/entry-points.js‎

Lines changed: 6 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/config-utils.ts‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1426,7 +1426,9 @@ export function saveAbortedInitConfig(
14261426
) {
14271427
// Should only be called by init.
14281428
if (action.name !== ActionName.Init) {
1429-
return;
1429+
throw new Error(
1430+
`Internal error: 'saveAbortedInitConfig' should only be called by '${ActionName.Init}', but was called by '${action.name}'.`,
1431+
);
14301432
}
14311433

14321434
// Create a copy of the input `Config` that only contains the keys we want.
@@ -1510,7 +1512,9 @@ export function getAbortedInitConfig(
15101512
): AbortedInitConfig | undefined {
15111513
// Only intended to be called by the `init-post` action.
15121514
if (action.name !== ActionName.InitPost) {
1513-
return undefined;
1515+
throw new Error(
1516+
`Internal error: 'getAbortedInitConfig' should only be called by '${ActionName.InitPost}', but was called by '${action.name}'.`,
1517+
);
15141518
}
15151519

15161520
return readConfigFile(action.logger, getPathToFailedConfigFile(tempDir));

0 commit comments

Comments
 (0)