aboutsummaryrefslogtreecommitdiff
path: root/Timeline/Services/TimelineMemberOperationUserException.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Timeline/Services/TimelineMemberOperationUserException.cs')
-rw-r--r--Timeline/Services/TimelineMemberOperationUserException.cs37
1 files changed, 37 insertions, 0 deletions
diff --git a/Timeline/Services/TimelineMemberOperationUserException.cs b/Timeline/Services/TimelineMemberOperationUserException.cs
new file mode 100644
index 00000000..543ee160
--- /dev/null
+++ b/Timeline/Services/TimelineMemberOperationUserException.cs
@@ -0,0 +1,37 @@
+using System;
+using System.Globalization;
+
+namespace Timeline.Services
+{
+ [Serializable]
+ public class TimelineMemberOperationUserException : Exception
+ {
+ public enum MemberOperation
+ {
+ Add,
+ Remove
+ }
+
+ public TimelineMemberOperationUserException() : base(Resources.Services.Exception.TimelineMemberOperationException) { }
+ public TimelineMemberOperationUserException(string message) : base(message) { }
+ public TimelineMemberOperationUserException(string message, Exception inner) : base(message, inner) { }
+ protected TimelineMemberOperationUserException(
+ System.Runtime.Serialization.SerializationInfo info,
+ System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
+
+ public TimelineMemberOperationUserException(int index, MemberOperation operation, string username, Exception inner)
+ : base(MakeMessage(operation, index), inner) { Operation = operation; Index = index; Username = username; }
+
+ private static string MakeMessage(MemberOperation operation, int index) => string.Format(CultureInfo.CurrentCulture,
+ Resources.Services.Exception.TimelineMemberOperationExceptionDetail, operation, index);
+
+ public MemberOperation? Operation { get; set; }
+
+ /// <summary>
+ /// The index of the member on which the operation failed.
+ /// </summary>
+ public int? Index { get; set; }
+
+ public string? Username { get; set; }
+ }
+}