diff options
author | crupest <crupest@outlook.com> | 2022-04-07 21:52:26 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2022-04-07 21:52:26 +0800 |
commit | a1f6b41accb47e4c1e1e0474148afa94732377da (patch) | |
tree | 019932d11ab14682f526b7cb9ab1be5a27fbbfdd /BackEnd/Timeline/Controllers/TimelineController.cs | |
parent | f8eecd3d50dec23d23b2fa1b6223b9c99d974214 (diff) | |
download | timeline-a1f6b41accb47e4c1e1e0474148afa94732377da.tar.gz timeline-a1f6b41accb47e4c1e1e0474148afa94732377da.tar.bz2 timeline-a1f6b41accb47e4c1e1e0474148afa94732377da.zip |
...
Diffstat (limited to 'BackEnd/Timeline/Controllers/TimelineController.cs')
-rw-r--r-- | BackEnd/Timeline/Controllers/TimelineController.cs | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/BackEnd/Timeline/Controllers/TimelineController.cs b/BackEnd/Timeline/Controllers/TimelineController.cs index a6749706..c10a8793 100644 --- a/BackEnd/Timeline/Controllers/TimelineController.cs +++ b/BackEnd/Timeline/Controllers/TimelineController.cs @@ -117,13 +117,21 @@ namespace Timeline.Controllers /// <returns>The timeline info.</returns>
[HttpGet("{timeline}")]
[ProducesResponseType(StatusCodes.Status200OK)]
+ [ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status404NotFound)]
public async Task<ActionResult<HttpTimeline>> TimelineGet([FromRoute][GeneralTimelineName] string timeline)
{
- var timelineId = await _service.GetTimelineIdByNameAsync(timeline);
- var t = await _service.GetTimelineAsync(timelineId);
- var result = await Map(t);
- return result;
+ 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); + }
}
/// <summary>
|