mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-07-05 21:33:02 +02:00
Remove exception handler
This commit is contained in:
parent
440f060da6
commit
5ef71d592b
|
@ -52,18 +52,11 @@ namespace Jellyfin.Api.Controllers
|
|||
[ProducesResponseType(typeof(DeviceInfo[]), StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(typeof(string), StatusCodes.Status500InternalServerError)]
|
||||
public IActionResult GetDevices([FromQuery] bool? supportsSync, [FromQuery] Guid? userId)
|
||||
{
|
||||
try
|
||||
{
|
||||
var deviceQuery = new DeviceQuery { SupportsSync = supportsSync, UserId = userId ?? Guid.Empty };
|
||||
var devices = _deviceManager.GetDevices(deviceQuery);
|
||||
return Ok(devices);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get info for a device.
|
||||
|
@ -76,8 +69,6 @@ namespace Jellyfin.Api.Controllers
|
|||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
[ProducesResponseType(typeof(string), StatusCodes.Status500InternalServerError)]
|
||||
public IActionResult GetDeviceInfo([FromQuery, BindRequired] string id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var deviceInfo = _deviceManager.GetDevice(id);
|
||||
if (deviceInfo == null)
|
||||
|
@ -87,11 +78,6 @@ namespace Jellyfin.Api.Controllers
|
|||
|
||||
return Ok(deviceInfo);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get options for a device.
|
||||
|
@ -104,8 +90,6 @@ namespace Jellyfin.Api.Controllers
|
|||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
[ProducesResponseType(typeof(string), StatusCodes.Status500InternalServerError)]
|
||||
public IActionResult GetDeviceOptions([FromQuery, BindRequired] string id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var deviceInfo = _deviceManager.GetDeviceOptions(id);
|
||||
if (deviceInfo == null)
|
||||
|
@ -115,11 +99,6 @@ namespace Jellyfin.Api.Controllers
|
|||
|
||||
return Ok(deviceInfo);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update device options.
|
||||
|
@ -135,8 +114,6 @@ namespace Jellyfin.Api.Controllers
|
|||
public IActionResult UpdateDeviceOptions(
|
||||
[FromQuery, BindRequired] string id,
|
||||
[FromBody, BindRequired] DeviceOptions deviceOptions)
|
||||
{
|
||||
try
|
||||
{
|
||||
var existingDeviceOptions = _deviceManager.GetDeviceOptions(id);
|
||||
if (existingDeviceOptions == null)
|
||||
|
@ -147,11 +124,6 @@ namespace Jellyfin.Api.Controllers
|
|||
_deviceManager.UpdateDeviceOptions(id, deviceOptions);
|
||||
return Ok();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a device.
|
||||
|
@ -162,8 +134,6 @@ namespace Jellyfin.Api.Controllers
|
|||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(typeof(string), StatusCodes.Status500InternalServerError)]
|
||||
public IActionResult DeleteDevice([FromQuery, BindRequired] string id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var sessions = _authenticationRepository.Get(new AuthenticationInfoQuery { DeviceId = id }).Items;
|
||||
|
||||
|
@ -174,11 +144,6 @@ namespace Jellyfin.Api.Controllers
|
|||
|
||||
return Ok();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets camera upload history for a device.
|
||||
|
@ -189,17 +154,10 @@ namespace Jellyfin.Api.Controllers
|
|||
[ProducesResponseType(typeof(ContentUploadHistory), StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(typeof(string), StatusCodes.Status500InternalServerError)]
|
||||
public IActionResult GetCameraUploads([FromQuery, BindRequired] string id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var uploadHistory = _deviceManager.GetCameraUploadHistory(id);
|
||||
return Ok(uploadHistory);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Uploads content.
|
||||
|
@ -218,8 +176,6 @@ namespace Jellyfin.Api.Controllers
|
|||
[FromQuery, BindRequired] string album,
|
||||
[FromQuery, BindRequired] string name,
|
||||
[FromQuery, BindRequired] string id)
|
||||
{
|
||||
try
|
||||
{
|
||||
Stream fileStream;
|
||||
string contentType;
|
||||
|
@ -245,20 +201,9 @@ namespace Jellyfin.Api.Controllers
|
|||
await _deviceManager.AcceptCameraUpload(
|
||||
deviceId,
|
||||
fileStream,
|
||||
new LocalFileInfo
|
||||
{
|
||||
MimeType = contentType,
|
||||
Album = album,
|
||||
Name = name,
|
||||
Id = id
|
||||
}).ConfigureAwait(false);
|
||||
new LocalFileInfo { MimeType = contentType, Album = album, Name = name, Id = id }).ConfigureAwait(false);
|
||||
|
||||
return Ok();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue