diff options
author | Kenneth Hsu <kennethhsu@gmail.com> | 2020-11-16 02:23:23 +0300 |
---|---|---|
committer | Kenneth Hsu <kennethhsu@gmail.com> | 2020-11-16 02:30:14 +0300 |
commit | 560c9957634f253296461aff9997f03318c28196 (patch) | |
tree | de7b1f5da209c3c4c6ae49ff727869115bdcc437 /Duplicati/Server | |
parent | 61056dd14cb9be5ecc3f8021be2873e833f77cb1 (diff) |
Improve some error and warning notification messages.
While this is more verbose and contains some elements that aren't
relevant to the user (e.g., class namespaces), it is arguably more
useful than just seeing "Got 1 warning(s)".
Diffstat (limited to 'Duplicati/Server')
-rw-r--r-- | Duplicati/Server/Runner.cs | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/Duplicati/Server/Runner.cs b/Duplicati/Server/Runner.cs index 38686d6af..bfdba1dfd 100644 --- a/Duplicati/Server/Runner.cs +++ b/Duplicati/Server/Runner.cs @@ -795,13 +795,24 @@ namespace Duplicati.Server if (r.FilesWithError > 0 || r.Warnings.Any() || r.Errors.Any())
{
+ string message;
+ if (r.FilesWithError > 0)
+ {
+ message = $"Errors affected {r.FilesWithError} file(s).";
+ }
+ else if (r.Errors.Any())
+ {
+ message = r.Errors.Count() == 1 ? r.Errors.Single() : $"Encountered {r.Errors.Count()} errors.";
+ }
+ else
+ {
+ message = r.Warnings.Count() == 1 ? r.Warnings.Single() : $"Encountered {r.Warnings.Count()} warnings.";
+ }
+
Program.DataConnection.RegisterNotification(
r.FilesWithError == 0 && !r.Errors.Any() ? NotificationType.Warning : NotificationType.Error,
backup.IsTemporary ? "Warning" : string.Format("Warning while running {0}", backup.Name),
- r.FilesWithError > 0 ? string.Format("Errors affected {0} file(s) ", r.FilesWithError) :
- (
- r.Errors.Any() ? string.Format("Got {0} error(s)", r.Errors.Count()) : string.Format("Got {0} warning(s)", r.Warnings.Count())
- ),
+ message,
null,
backup.ID,
"backup:show-log",
|