Skip to content

Commit be44186

Browse files
Adds check for mocks file path. Closes #312 (#323)
1 parent eb64ae8 commit be44186

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

m365-developer-proxy-plugins/MockResponses/MockResponsesLoader.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ public void InitResponsesWatcher() {
5151
}
5252

5353
string path = Path.GetDirectoryName(_responsesFilePath) ?? throw new InvalidOperationException($"{_responsesFilePath} is an invalid path");
54+
if (!File.Exists(_responsesFilePath)) {
55+
_logger.LogWarn($"File {_configuration.MocksFile} not found. No mocks will be provided");
56+
_configuration.Responses = Array.Empty<MockResponse>();
57+
return;
58+
}
59+
5460
_watcher = new FileSystemWatcher(Path.GetFullPath(path));
5561
_watcher.NotifyFilter = NotifyFilters.CreationTime
5662
| NotifyFilters.FileName

0 commit comments

Comments
 (0)