Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/startApp.ts
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
);
});
});