Remove error handlers, to be implemented at a global level in a separate PR

pull/2876/head
ZadenRB 4 years ago
parent 688240151b
commit 67efcbee05

@ -74,14 +74,7 @@ namespace Jellyfin.Api.Controllers
[ProducesResponseType(typeof(IEnumerable<NameIdPair>), StatusCodes.Status200OK)] [ProducesResponseType(typeof(IEnumerable<NameIdPair>), StatusCodes.Status200OK)]
public IActionResult GetNotificationTypes() public IActionResult GetNotificationTypes()
{ {
try return Ok(_notificationManager.GetNotificationTypes());
{
return Ok(_notificationManager.GetNotificationTypes());
}
catch (Exception e)
{
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
}
} }
/// <summary> /// <summary>
@ -92,14 +85,7 @@ namespace Jellyfin.Api.Controllers
[ProducesResponseType(typeof(IEnumerable<NameIdPair>), StatusCodes.Status200OK)] [ProducesResponseType(typeof(IEnumerable<NameIdPair>), StatusCodes.Status200OK)]
public IActionResult GetNotificationServices() public IActionResult GetNotificationServices()
{ {
try return Ok(_notificationManager.GetNotificationServices());
{
return Ok(_notificationManager.GetNotificationServices());
}
catch (Exception e)
{
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
}
} }
/// <summary> /// <summary>
@ -112,32 +98,23 @@ namespace Jellyfin.Api.Controllers
/// <returns>Status.</returns> /// <returns>Status.</returns>
[HttpPost("Admin")] [HttpPost("Admin")]
[ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status200OK)]
public IActionResult CreateAdminNotification( public void CreateAdminNotification(
[FromQuery] string name, [FromQuery] string name,
[FromQuery] string description, [FromQuery] string description,
[FromQuery] string? url, [FromQuery] string? url,
[FromQuery] NotificationLevel? level) [FromQuery] NotificationLevel? level)
{ {
try var notification = new NotificationRequest
{ {
var notification = new NotificationRequest Name = name,
{ Description = description,
Name = name, Url = url,
Description = description, Level = level ?? NotificationLevel.Normal,
Url = url, UserIds = _userManager.Users.Where(i => i.Policy.IsAdministrator).Select(i => i.Id).ToArray(),
Level = level ?? NotificationLevel.Normal, Date = DateTime.UtcNow,
UserIds = _userManager.Users.Where(i => i.Policy.IsAdministrator).Select(i => i.Id).ToArray(), };
Date = DateTime.UtcNow,
};
_notificationManager.SendNotification(notification, CancellationToken.None);
return Ok(); _notificationManager.SendNotification(notification, CancellationToken.None);
}
catch (Exception e)
{
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
}
} }
/// <summary> /// <summary>

Loading…
Cancel
Save