Skip to content

Commit

Permalink
fix: add brreg exception handling to coordination and trend alle
Browse files Browse the repository at this point in the history
  • Loading branch information
SondreJDigdir committed Nov 21, 2024
1 parent 471dde3 commit 87b6cb1
Showing 1 changed file with 36 additions and 2 deletions.
38 changes: 36 additions & 2 deletions src/Dan.Plugin.Tilda/Tilda.cs
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,24 @@ private async Task<List<EvidenceValue>> GetEvidenceValuesTrendAll(EvidenceHarves
}
}

await Task.WhenAll(taskList);
var taskResult = Task.WhenAll(taskList);
try
{
await taskResult;
}
catch (Exception e)

Check warning on line 707 in src/Dan.Plugin.Tilda/Tilda.cs

View workflow job for this annotation

GitHub Actions / run / build

The variable 'e' is declared but never used

Check warning on line 707 in src/Dan.Plugin.Tilda/Tilda.cs

View workflow job for this annotation

GitHub Actions / run / build

The variable 'e' is declared but never used
{
// Don't want one failed fetch to break the listing of the rest of the orgs
if (taskResult.IsFaulted)
{
var failedTasks = taskList.Where(task => task.IsFaulted).ToList();
foreach (var task in failedTasks)
{
_logger.LogError(task.Exception, task.Exception?.Message);
}
taskList = taskList.Where(task => !task.IsFaulted).ToList();
}
}

foreach (var t in taskList)
{
Expand Down Expand Up @@ -758,7 +775,24 @@ private async Task<List<EvidenceValue>> GetEvidenceValuesTilsynskoordingeringAll
}
}

await Task.WhenAll(taskList);
var taskResult = Task.WhenAll(taskList);
try
{
await taskResult;
}
catch (Exception e)

Check warning on line 783 in src/Dan.Plugin.Tilda/Tilda.cs

View workflow job for this annotation

GitHub Actions / run / build

The variable 'e' is declared but never used

Check warning on line 783 in src/Dan.Plugin.Tilda/Tilda.cs

View workflow job for this annotation

GitHub Actions / run / build

The variable 'e' is declared but never used
{
// Don't want one failed fetch to break the listing of the rest of the orgs
if (taskResult.IsFaulted)
{
var failedTasks = taskList.Where(task => task.IsFaulted).ToList();
foreach (var task in failedTasks)
{
_logger.LogError(task.Exception, task.Exception?.Message);
}
taskList = taskList.Where(task => !task.IsFaulted).ToList();
}
}
taskList = taskList
.Where(task => task.Result is not null)
.GroupBy(x => x.Result.OrganizationNumber)
Expand Down

0 comments on commit 87b6cb1

Please sign in to comment.