25 行
768 B
C#
25 行
768 B
C#
namespace GitHubUpdateNotifier;
|
|
|
|
public sealed class UpdateCheckException : Exception
|
|
{
|
|
public string Owner { get; }
|
|
public string Repository { get; }
|
|
public IReadOnlyList<Exception> Failures { get; }
|
|
|
|
internal UpdateCheckException(RepositoryReference repository, IReadOnlyList<Exception> failures)
|
|
: base($"No release information could be retrieved for '{repository}'.", BuildInner(failures))
|
|
{
|
|
Owner = repository.Owner;
|
|
Repository = repository.Name;
|
|
Failures = failures;
|
|
}
|
|
|
|
private static Exception? BuildInner(IReadOnlyList<Exception> failures)
|
|
=> failures.Count switch
|
|
{
|
|
0 => null,
|
|
1 => failures[0],
|
|
_ => new AggregateException(failures),
|
|
};
|
|
}
|