diff options
author | 杨宇千 <crupest@outlook.com> | 2019-11-07 22:06:06 +0800 |
---|---|---|
committer | 杨宇千 <crupest@outlook.com> | 2019-11-07 22:06:06 +0800 |
commit | 2f36e9a1c8d6db2a808f874134c9cb7d57c3ef16 (patch) | |
tree | 48ca95c6eb5dafe44d419bbe5d0ab49396209b13 /Timeline/Services/TimelineMemberOperationUserException.cs | |
parent | 2852190501ea6636f93d6bc06f8eb4a11cab1077 (diff) | |
download | timeline-2f36e9a1c8d6db2a808f874134c9cb7d57c3ef16.tar.gz timeline-2f36e9a1c8d6db2a808f874134c9cb7d57c3ef16.tar.bz2 timeline-2f36e9a1c8d6db2a808f874134c9cb7d57c3ef16.zip |
Complete PersonalTimelineController and write attribute test.
Diffstat (limited to 'Timeline/Services/TimelineMemberOperationUserException.cs')
-rw-r--r-- | Timeline/Services/TimelineMemberOperationUserException.cs | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/Timeline/Services/TimelineMemberOperationUserException.cs b/Timeline/Services/TimelineMemberOperationUserException.cs index 998f1a6e..543ee160 100644 --- a/Timeline/Services/TimelineMemberOperationUserException.cs +++ b/Timeline/Services/TimelineMemberOperationUserException.cs @@ -6,6 +6,12 @@ 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) { }
@@ -13,10 +19,13 @@ namespace Timeline.Services System.Runtime.Serialization.SerializationInfo info,
System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- public TimelineMemberOperationUserException(int index, string username, Exception inner) : base(MakeIndexMessage(index), inner) { Index = index; Username = username; }
+ 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);
- private static string MakeIndexMessage(int index) => string.Format(CultureInfo.CurrentCulture,
- Resources.Services.Exception.TimelineMemberOperationExceptionIndex, index);
+ public MemberOperation? Operation { get; set; }
/// <summary>
/// The index of the member on which the operation failed.
|