Skip to content

Commit

Permalink
catch exceptions from container providers
Browse files Browse the repository at this point in the history
  • Loading branch information
IS4Code committed Apr 17, 2023
1 parent 419632f commit 4a3eaec
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions SFI/EntityAnalyzerProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,13 @@ private async ValueTask<AnalysisResult> Analyze<T>(T entity, AnalysisContext con
}
return result;
}
OutputLog.WriteLine($"[{nameOrdinal}] No result!");
OutputLog.WriteLine($"[{nameOrdinal}] No result from {TextTools.GetUserFriendlyName(analyzer)}!");
}catch(InternalApplicationException)
{
throw;
}catch(Exception e) when(GlobalOptions.SuppressNonCriticalExceptions)
{
OutputLog.WriteLine($"[{nameOrdinal}] Error!");
OutputLog.WriteLine($"[{nameOrdinal}] Error from {TextTools.GetUserFriendlyName(analyzer)}!");
OutputLog.WriteLine(e);
return default;
}finally{
Expand Down Expand Up @@ -124,15 +124,24 @@ private async ValueTask<AnalysisResult> Analyze<T>(T entity, AnalysisContext con
{
if(blocked == null || !blocked.Contains(containerProvider))
{
var analyzer = containerProvider.MatchRoot(root, context);
if(analyzer != null)
{
// If the provider is not blocked and the root matches, add it to the collection
if(analyzerList == null)
try{
var analyzer = containerProvider.MatchRoot(root, context);
if(analyzer != null)
{
analyzerList = new List<ContainerAnalysisInfo>();
// If the provider is not blocked and the root matches, add it to the collection
if(analyzerList == null)
{
analyzerList = new List<ContainerAnalysisInfo>();
}
analyzerList.Add(new ContainerAnalysisInfo(analyzer, containerProvider));
}
analyzerList.Add(new ContainerAnalysisInfo(analyzer, containerProvider));
}catch(InternalApplicationException)
{
throw;
}catch(Exception e) when(GlobalOptions.SuppressNonCriticalExceptions)
{
OutputLog.WriteLine($"[{TextTools.GetIdentifierFromType<TRoot>()}] Error from {TextTools.GetUserFriendlyName(containerProvider)}!");
OutputLog.WriteLine(e);
}
}
}
Expand Down

0 comments on commit 4a3eaec

Please sign in to comment.