Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

Commit 090b530

Browse files
authored
Catch exceptions when importing from search paths (#525)
* catch exceptions when importing from search paths * retry instead of not found
1 parent 7d7ca94 commit 090b530

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/Analysis/Engine/Impl/Interpreter/Ast/AstModuleResolution.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,12 @@ public async Task<TryImportModuleResult> TryImportModuleAsync(string name, PathR
205205
} catch (OperationCanceledException) {
206206
_log?.Log(TraceLevel.Error, "ImportTimeout", name, "ImportFromSearchPaths");
207207
return TryImportModuleResult.Timeout;
208+
} catch (Exception ex) when (
209+
ex is IOException // FileNotFoundException, DirectoryNotFoundException, PathTooLongException, etc
210+
|| ex is UnauthorizedAccessException
211+
) {
212+
_log?.Log(TraceLevel.Error, "ImportException", name, "ImportFromSearchPaths", ex.GetType().Name, ex.Message);
213+
return TryImportModuleResult.NeedRetry;
208214
}
209215
}
210216

0 commit comments

Comments
 (0)