From 67efcbee05fe7917aaff11fd27235fb952938434 Mon Sep 17 00:00:00 2001 From: ZadenRB Date: Mon, 20 Apr 2020 20:16:58 -0600 Subject: [PATCH] Remove error handlers, to be implemented at a global level in a separate PR --- .../Controllers/NotificationsController.cs | 47 +++++-------------- 1 file changed, 12 insertions(+), 35 deletions(-) diff --git a/Jellyfin.Api/Controllers/NotificationsController.cs b/Jellyfin.Api/Controllers/NotificationsController.cs index c0c2be626b..2a41f6020e 100644 --- a/Jellyfin.Api/Controllers/NotificationsController.cs +++ b/Jellyfin.Api/Controllers/NotificationsController.cs @@ -74,14 +74,7 @@ namespace Jellyfin.Api.Controllers [ProducesResponseType(typeof(IEnumerable), StatusCodes.Status200OK)] public IActionResult GetNotificationTypes() { - try - { - return Ok(_notificationManager.GetNotificationTypes()); - } - catch (Exception e) - { - return StatusCode(StatusCodes.Status500InternalServerError, e.Message); - } + return Ok(_notificationManager.GetNotificationTypes()); } /// @@ -92,14 +85,7 @@ namespace Jellyfin.Api.Controllers [ProducesResponseType(typeof(IEnumerable), StatusCodes.Status200OK)] public IActionResult GetNotificationServices() { - try - { - return Ok(_notificationManager.GetNotificationServices()); - } - catch (Exception e) - { - return StatusCode(StatusCodes.Status500InternalServerError, e.Message); - } + return Ok(_notificationManager.GetNotificationServices()); } /// @@ -112,32 +98,23 @@ namespace Jellyfin.Api.Controllers /// Status. [HttpPost("Admin")] [ProducesResponseType(StatusCodes.Status200OK)] - public IActionResult CreateAdminNotification( + public void CreateAdminNotification( [FromQuery] string name, [FromQuery] string description, [FromQuery] string? url, [FromQuery] NotificationLevel? level) { - try + var notification = new NotificationRequest { - var notification = new NotificationRequest - { - Name = name, - Description = description, - Url = url, - Level = level ?? NotificationLevel.Normal, - UserIds = _userManager.Users.Where(i => i.Policy.IsAdministrator).Select(i => i.Id).ToArray(), - Date = DateTime.UtcNow, - }; + Name = name, + Description = description, + Url = url, + Level = level ?? NotificationLevel.Normal, + UserIds = _userManager.Users.Where(i => i.Policy.IsAdministrator).Select(i => i.Id).ToArray(), + Date = DateTime.UtcNow, + }; - _notificationManager.SendNotification(notification, CancellationToken.None); - - return Ok(); - } - catch (Exception e) - { - return StatusCode(StatusCodes.Status500InternalServerError, e.Message); - } + _notificationManager.SendNotification(notification, CancellationToken.None); } ///