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
commitd6e9ae92a782f747752d9e26504dc2f27e723f04 (patch)
tree57e3d021f6bd2aaa747e1e8fbffdf6a2636977f5 /Timeline/Services/TimelineService.cs
parentb2dcd4529bfb80fa2f1e6095cd5c976d4e90ec8e (diff)
downloadtimeline-d6e9ae92a782f747752d9e26504dc2f27e723f04.tar.gz
timeline-d6e9ae92a782f747752d9e26504dc2f27e723f04.tar.bz2
timeline-d6e9ae92a782f747752d9e26504dc2f27e723f04.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
{