Skip to content

Commit abf81b9

Browse files
authored
Treat failure to load entry point as warning instead of error (#631)
1 parent e582808 commit abf81b9

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

src/startApp.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,11 @@ async function loadEntryPointFile(functionAppDirectory: string, channel: WorkerC
6464
}
6565
} catch (err) {
6666
const error = ensureErrorType(err);
67-
error.isAzureFunctionsSystemError = true;
68-
error.message = `Worker was unable to load entry point "${entryPointPattern}": ${error.message}`;
69-
throw error;
67+
channel.log({
68+
message: `Worker was unable to load entry point "${entryPointPattern}": ${error.message}`,
69+
level: LogLevel.Warning,
70+
logCategory: LogCategory.System,
71+
});
7072
}
7173
}
7274
}

test/eventHandlers/WorkerInitHandler.test.ts

+5-9
Original file line numberDiff line numberDiff line change
@@ -295,12 +295,8 @@ describe('WorkerInitHandler', () => {
295295
});
296296

297297
stream.addTestMessage(Msg.init(__dirname));
298-
const errorMessage = `Worker was unable to load entry point "${fileName}": Found zero files matching the supplied pattern`;
299-
await stream.assertCalledWith(
300-
Msg.receivedInitLog,
301-
Msg.error(errorMessage),
302-
Msg.failedResponse(fileName, errorMessage)
303-
);
298+
const warningMessage = `Worker was unable to load entry point "${fileName}": Found zero files matching the supplied pattern`;
299+
await stream.assertCalledWith(Msg.receivedInitLog, Msg.warning(warningMessage), Msg.response);
304300
});
305301

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

319315
stream.addTestMessage(Msg.init(__dirname));
320-
const errorMessage = `Worker was unable to load entry point "${fileName}": test`;
316+
const warningMessage = `Worker was unable to load entry point "${fileName}": test`;
321317
await stream.assertCalledWith(
322318
Msg.receivedInitLog,
323319
Msg.loadingEntryPoint(fileName),
324-
Msg.error(errorMessage),
325-
Msg.failedResponse(fileName, errorMessage)
320+
Msg.warning(warningMessage),
321+
Msg.response
326322
);
327323
});
328324
});

0 commit comments

Comments
 (0)