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

Commit

Permalink
Catch exceptions when importing from search paths (#525)
Browse files Browse the repository at this point in the history
* catch exceptions when importing from search paths

* retry instead of not found
  • Loading branch information
jakebailey authored Jan 17, 2019
1 parent 7d7ca94 commit 090b530
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,12 @@ public async Task<TryImportModuleResult> TryImportModuleAsync(string name, PathR
} catch (OperationCanceledException) {
_log?.Log(TraceLevel.Error, "ImportTimeout", name, "ImportFromSearchPaths");
return TryImportModuleResult.Timeout;
} catch (Exception ex) when (
ex is IOException // FileNotFoundException, DirectoryNotFoundException, PathTooLongException, etc
|| ex is UnauthorizedAccessException
) {
_log?.Log(TraceLevel.Error, "ImportException", name, "ImportFromSearchPaths", ex.GetType().Name, ex.Message);
return TryImportModuleResult.NeedRetry;
}
}

Expand Down

0 comments on commit 090b530

Please sign in to comment.