diff options
author | crupest <crupest@outlook.com> | 2022-04-07 22:24:59 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2022-04-07 22:24:59 +0800 |
commit | 9e559fc918d4b4485ef589184348686927ebd63c (patch) | |
tree | 4acdc6ee20dfe66cafd413c21ca50b35d217f506 /BackEnd/Timeline/Controllers/TimelineController.cs | |
parent | a1f6b41accb47e4c1e1e0474148afa94732377da (diff) | |
download | timeline-9e559fc918d4b4485ef589184348686927ebd63c.tar.gz timeline-9e559fc918d4b4485ef589184348686927ebd63c.tar.bz2 timeline-9e559fc918d4b4485ef589184348686927ebd63c.zip |
...
Diffstat (limited to 'BackEnd/Timeline/Controllers/TimelineController.cs')
-rw-r--r-- | BackEnd/Timeline/Controllers/TimelineController.cs | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/BackEnd/Timeline/Controllers/TimelineController.cs b/BackEnd/Timeline/Controllers/TimelineController.cs index c10a8793..7aeec02f 100644 --- a/BackEnd/Timeline/Controllers/TimelineController.cs +++ b/BackEnd/Timeline/Controllers/TimelineController.cs @@ -21,6 +21,7 @@ namespace Timeline.Controllers /// </summary>
[ApiController]
[Route("timelines")]
+ [CatchMultipleTimelineException]
[ProducesErrorResponseType(typeof(CommonResponse))]
public class TimelineController : MyControllerBase
{
@@ -120,18 +121,11 @@ namespace Timeline.Controllers [ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status404NotFound)]
public async Task<ActionResult<HttpTimeline>> TimelineGet([FromRoute][GeneralTimelineName] string timeline)
- {
- try - { - var timelineId = await _service.GetTimelineIdByNameAsync(timeline); - var t = await _service.GetTimelineAsync(timelineId); - var result = await Map(t); - return result;
- }
- catch (MultipleTimelineException)
- { - return BadRequestWithCommonResponse(ErrorCodes.TimelineController.MultipleTimelineWithSameName, Resource.MessageMultipleTimeline); - }
+ { + var timelineId = await _service.GetTimelineIdByNameAsync(timeline); + var t = await _service.GetTimelineAsync(timelineId); + var result = await Map(t); + return result;
}
/// <summary>
|