Skip to content

Commit

Permalink
If only 1 exception, just throw, don't bundle in AggregateException
Browse files Browse the repository at this point in the history
  • Loading branch information
BlythMeister committed Feb 20, 2019
1 parent e076c41 commit d805ff0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/Ensconce.Console/TagSubstitution.cs
Expand Up @@ -2,6 +2,7 @@
using System;
using System.Collections.Concurrent;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

Expand Down Expand Up @@ -36,7 +37,8 @@ internal static void UpdateFiles()
}
});

if (exceptions.Count > 0) throw new AggregateException(exceptions);
if (exceptions.Count == 1) throw exceptions.First();
if (exceptions.Count > 1) throw new AggregateException(exceptions);
}

private static void UpdateSingleFile(FileInfo templateFile)
Expand Down
3 changes: 2 additions & 1 deletion src/Ensconce.Update/UpdateFile.cs
Expand Up @@ -73,7 +73,8 @@ public static void UpdateFiles(string substitutionFile, Lazy<TagDictionary> tagV
}
});

if (exceptions.Count > 0) throw new AggregateException(exceptions);
if (exceptions.Count == 1) throw exceptions.First();
if (exceptions.Count > 1) throw new AggregateException(exceptions);
}

public static string Update(string substitutionFile, string baseFile, Lazy<TagDictionary> tagValues = null, bool outputFailureContext = false)
Expand Down

0 comments on commit d805ff0

Please sign in to comment.