From 7594a16e38304739487b053405153379faee6e58 Mon Sep 17 00:00:00 2001 From: crupest Date: Thu, 7 Jan 2021 16:23:20 +0800 Subject: 史诗级重构! MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Exceptions/TimelinePostNotExistException.cs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'BackEnd/Timeline/Services/Exceptions/TimelinePostNotExistException.cs') diff --git a/BackEnd/Timeline/Services/Exceptions/TimelinePostNotExistException.cs b/BackEnd/Timeline/Services/Exceptions/TimelinePostNotExistException.cs index f95dd410..2a7b5b28 100644 --- a/BackEnd/Timeline/Services/Exceptions/TimelinePostNotExistException.cs +++ b/BackEnd/Timeline/Services/Exceptions/TimelinePostNotExistException.cs @@ -14,16 +14,21 @@ namespace Timeline.Services.Exceptions protected TimelinePostNotExistException( System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { } + public TimelinePostNotExistException(long? timelineId, long? postId, bool isDelete, string? message = null, Exception? inner = null) + : base(EntityNames.TimelinePost, null, MakeMessage(timelineId, postId, isDelete).AppendAdditionalMessage(message), inner) + { + TimelineId = timelineId; + PostId = postId; + IsDelete = isDelete; + } - public TimelinePostNotExistException(string? timelineName, long? id, bool isDelete, string? message = null, Exception? inner = null) : base(EntityNames.TimelinePost, null, MakeMessage(timelineName, id, isDelete).AppendAdditionalMessage(message), inner) { TimelineName = timelineName; Id = id; IsDelete = isDelete; } - - private static string MakeMessage(string? timelineName, long? id, bool isDelete) + private static string MakeMessage(long? timelineId, long? postId, bool isDelete) { - return string.Format(CultureInfo.InvariantCulture, isDelete ? Resources.Services.Exceptions.TimelinePostNotExistExceptionDeleted : Resources.Services.Exceptions.TimelinePostNotExistException, timelineName ?? "", id); + return string.Format(CultureInfo.InvariantCulture, isDelete ? Resources.Services.Exceptions.TimelinePostNotExistExceptionDeleted : Resources.Services.Exceptions.TimelinePostNotExistException, timelineId, postId); } - public string? TimelineName { get; set; } - public long? Id { get; set; } + public long? TimelineId { get; set; } + public long? PostId { get; set; } /// /// True if the post is deleted. False if the post does not exist at all. -- cgit v1.2.3