Skip to content

Commit

Permalink
Treat failure to load entry point as warning instead of error (#631)
Browse files Browse the repository at this point in the history
  • Loading branch information
ejizba committed Oct 4, 2022
1 parent e582808 commit abf81b9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
8 changes: 5 additions & 3 deletions src/startApp.ts
Expand Up @@ -64,9 +64,11 @@ async function loadEntryPointFile(functionAppDirectory: string, channel: WorkerC
}
} catch (err) {
const error = ensureErrorType(err);
error.isAzureFunctionsSystemError = true;
error.message = `Worker was unable to load entry point "${entryPointPattern}": ${error.message}`;
throw error;
channel.log({
message: `Worker was unable to load entry point "${entryPointPattern}": ${error.message}`,
level: LogLevel.Warning,
logCategory: LogCategory.System,
});
}
}
}
14 changes: 5 additions & 9 deletions test/eventHandlers/WorkerInitHandler.test.ts
Expand Up @@ -295,12 +295,8 @@ describe('WorkerInitHandler', () => {
});

stream.addTestMessage(Msg.init(__dirname));
const errorMessage = `Worker was unable to load entry point "${fileName}": Found zero files matching the supplied pattern`;
await stream.assertCalledWith(
Msg.receivedInitLog,
Msg.error(errorMessage),
Msg.failedResponse(fileName, errorMessage)
);
const warningMessage = `Worker was unable to load entry point "${fileName}": Found zero files matching the supplied pattern`;
await stream.assertCalledWith(Msg.receivedInitLog, Msg.warning(warningMessage), Msg.response);
});

it('Fails for invalid entry point', async function (this: ITestCallbackContext) {
Expand All @@ -317,12 +313,12 @@ describe('WorkerInitHandler', () => {
});

stream.addTestMessage(Msg.init(__dirname));
const errorMessage = `Worker was unable to load entry point "${fileName}": test`;
const warningMessage = `Worker was unable to load entry point "${fileName}": test`;
await stream.assertCalledWith(
Msg.receivedInitLog,
Msg.loadingEntryPoint(fileName),
Msg.error(errorMessage),
Msg.failedResponse(fileName, errorMessage)
Msg.warning(warningMessage),
Msg.response
);
});
});

0 comments on commit abf81b9

Please sign in to comment.