diff options
Diffstat (limited to 'BackEnd/Timeline/Services/Api')
6 files changed, 10 insertions, 34 deletions
diff --git a/BackEnd/Timeline/Services/Api/BookmarkTimelineService.cs b/BackEnd/Timeline/Services/Api/BookmarkTimelineService.cs index de70a9db..9d6ec93f 100644 --- a/BackEnd/Timeline/Services/Api/BookmarkTimelineService.cs +++ b/BackEnd/Timeline/Services/Api/BookmarkTimelineService.cs @@ -68,7 +68,10 @@ namespace Timeline.Services.Api var entity = await _database.BookmarkTimelines.SingleOrDefaultAsync(t => t.TimelineId == timelineId && t.UserId == userId);
- if (entity == null) throw new InvalidBookmarkException("You can't move a non-bookmark timeline.");
+ if (entity is null)
+ {
+ throw new EntityNotExistException(EntityTypes.BookmarkTimeline);
+ }
var oldPosition = entity.Rank;
diff --git a/BackEnd/Timeline/Services/Api/HighlightTimelineService.cs b/BackEnd/Timeline/Services/Api/HighlightTimelineService.cs index d4367e57..eb606ae6 100644 --- a/BackEnd/Timeline/Services/Api/HighlightTimelineService.cs +++ b/BackEnd/Timeline/Services/Api/HighlightTimelineService.cs @@ -81,7 +81,10 @@ namespace Timeline.Services.Api var entity = await _database.HighlightTimelines.SingleOrDefaultAsync(t => t.TimelineId == timelineId);
- if (entity == null) throw new InvalidHighlightTimelineException("You can't move a non-highlight timeline.");
+ if (entity is null)
+ {
+ throw new EntityNotExistException(EntityTypes.HighlightTimeline);
+ }
var oldPosition = entity.Order;
diff --git a/BackEnd/Timeline/Services/Api/IBookmarkTimelineService.cs b/BackEnd/Timeline/Services/Api/IBookmarkTimelineService.cs index c3cda450..468a885b 100644 --- a/BackEnd/Timeline/Services/Api/IBookmarkTimelineService.cs +++ b/BackEnd/Timeline/Services/Api/IBookmarkTimelineService.cs @@ -56,7 +56,7 @@ namespace Timeline.Services.Api /// <param name="newPosition">New position. Starts at 1.</param>
/// <exception cref="EntityNotExistException">Thrown when user does not exist.</exception>
/// <exception cref="EntityNotExistException">Thrown when timeline does not exist.</exception>
- /// <exception cref="InvalidBookmarkException">Thrown when the timeline is not a bookmark.</exception>
+ /// <exception cref="EntityNotExistException">Thrown when the timeline is not a bookmark.</exception>
Task MoveBookmarkAsync(long userId, long timelineId, long newPosition);
}
}
diff --git a/BackEnd/Timeline/Services/Api/IHighlightTimelineService.cs b/BackEnd/Timeline/Services/Api/IHighlightTimelineService.cs index 56a0fb35..0ca6759c 100644 --- a/BackEnd/Timeline/Services/Api/IHighlightTimelineService.cs +++ b/BackEnd/Timeline/Services/Api/IHighlightTimelineService.cs @@ -49,7 +49,7 @@ namespace Timeline.Services.Api /// <param name="timelineId">The timeline name.</param>
/// <param name="newPosition">The new position. Starts at 1.</param>
/// <exception cref="EntityNotExistException">Thrown when timeline with given id does not exist.</exception>
- /// <exception cref="InvalidHighlightTimelineException">Thrown when given timeline is not a highlight timeline.</exception>
+ /// <exception cref="EntityNotExistException">Thrown when given timeline is not a highlight timeline.</exception>
/// <remarks>
/// If <paramref name="newPosition"/> is smaller than 1. Then move the timeline to head.
/// If <paramref name="newPosition"/> is bigger than total count. Then move the timeline to tail.
diff --git a/BackEnd/Timeline/Services/Api/InvalidBookmarkException.cs b/BackEnd/Timeline/Services/Api/InvalidBookmarkException.cs deleted file mode 100644 index 39572b38..00000000 --- a/BackEnd/Timeline/Services/Api/InvalidBookmarkException.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System;
-
-namespace Timeline.Services.Api
-{
- [Serializable]
- public class InvalidBookmarkException : Exception
- {
- public InvalidBookmarkException() { }
- public InvalidBookmarkException(string message) : base(message) { }
- public InvalidBookmarkException(string message, Exception inner) : base(message, inner) { }
- protected InvalidBookmarkException(
- System.Runtime.Serialization.SerializationInfo info,
- System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- }
-}
diff --git a/BackEnd/Timeline/Services/Api/InvalidHighlightTimelineException.cs b/BackEnd/Timeline/Services/Api/InvalidHighlightTimelineException.cs deleted file mode 100644 index 13b04a6b..00000000 --- a/BackEnd/Timeline/Services/Api/InvalidHighlightTimelineException.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System;
-
-namespace Timeline.Services.Api
-{
- [Serializable]
- public class InvalidHighlightTimelineException : Exception
- {
- public InvalidHighlightTimelineException() { }
- public InvalidHighlightTimelineException(string message) : base(message) { }
- public InvalidHighlightTimelineException(string message, Exception inner) : base(message, inner) { }
- protected InvalidHighlightTimelineException(
- System.Runtime.Serialization.SerializationInfo info,
- System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- }
-}
|