aboutsummaryrefslogtreecommitdiff
path: root/Timeline/Services/TimelineService.cs
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2020-06-13 00:28:35 +0800
committercrupest <crupest@outlook.com>2020-06-13 00:28:35 +0800
commiteba8e9698c09b805d8ac2a8f58db93b947ac29e3 (patch)
treec3bf0aef9d80c19e9a71e9e9aaab16b8364db15b /Timeline/Services/TimelineService.cs
parentcc62df19e5f8aa216660915f46ff290c8eeab1d0 (diff)
downloadtimeline-eba8e9698c09b805d8ac2a8f58db93b947ac29e3.tar.gz
timeline-eba8e9698c09b805d8ac2a8f58db93b947ac29e3.tar.bz2
timeline-eba8e9698c09b805d8ac2a8f58db93b947ac29e3.zip
refactor(back): Fix #100 .
Diffstat (limited to 'Timeline/Services/TimelineService.cs')
-rw-r--r--Timeline/Services/TimelineService.cs9
1 files changed, 5 insertions, 4 deletions
diff --git a/Timeline/Services/TimelineService.cs b/Timeline/Services/TimelineService.cs
index aecfeeec..a473ae66 100644
--- a/Timeline/Services/TimelineService.cs
+++ b/Timeline/Services/TimelineService.cs
@@ -10,6 +10,7 @@ using Timeline.Entities;
using Timeline.Helpers;
using Timeline.Models;
using Timeline.Models.Validation;
+using Timeline.Services.Exceptions;
using static Timeline.Resources.Services.TimelineService;
namespace Timeline.Services
@@ -428,7 +429,7 @@ namespace Timeline.Services
var postEntity = await Database.TimelinePosts.Where(p => p.TimelineId == timelineId && p.LocalId == postId).SingleOrDefaultAsync();
if (postEntity == null)
- throw new TimelinePostNotExistException(name, postId);
+ throw new TimelinePostNotExistException(name, postId, false);
if (postEntity.Content == null)
throw new TimelinePostNotExistException(name, postId, true);
@@ -450,7 +451,7 @@ namespace Timeline.Services
var postEntity = await Database.TimelinePosts.Where(p => p.TimelineId == timelineId && p.LocalId == postId).SingleOrDefaultAsync();
if (postEntity == null)
- throw new TimelinePostNotExistException(name, postId);
+ throw new TimelinePostNotExistException(name, postId, false);
if (postEntity.Content == null)
throw new TimelinePostNotExistException(name, postId, true);
@@ -586,7 +587,7 @@ namespace Timeline.Services
var post = await Database.TimelinePosts.Where(p => p.TimelineId == timelineId && p.LocalId == id).SingleOrDefaultAsync();
if (post == null || post.Content == null)
- throw new TimelinePostNotExistException(name, id);
+ throw new TimelinePostNotExistException(name, id, false);
string? dataTag = null;
@@ -977,7 +978,7 @@ namespace Timeline.Services
var conflict = await _database.Timelines.AnyAsync(t => t.Name == name);
if (conflict)
- throw new ConflictException(ExceptionTimelineNameConflict);
+ throw new EntityAlreadyExistException(EntityNames.Timeline, null, ExceptionTimelineNameConflict);
var newEntity = new TimelineEntity
{