Remove exception handler

This commit is contained in:
crobibero 2020-04-21 08:02:07 -06:00
parent a96db5f48e
commit 8ab9949db5

View file

@ -40,8 +40,6 @@ namespace Jellyfin.Api.Controllers
public IActionResult GetTasks( public IActionResult GetTasks(
[FromQuery] bool? isHidden = false, [FromQuery] bool? isHidden = false,
[FromQuery] bool? isEnabled = false) [FromQuery] bool? isEnabled = false)
{
try
{ {
IEnumerable<IScheduledTaskWorker> tasks = _taskManager.ScheduledTasks.OrderBy(o => o.Name); IEnumerable<IScheduledTaskWorker> tasks = _taskManager.ScheduledTasks.OrderBy(o => o.Name);
@ -79,11 +77,6 @@ namespace Jellyfin.Api.Controllers
return Ok(taskInfos); return Ok(taskInfos);
} }
catch (Exception e)
{
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
}
}
/// <summary> /// <summary>
/// Get task by id. /// Get task by id.
@ -95,8 +88,6 @@ namespace Jellyfin.Api.Controllers
[ProducesResponseType(StatusCodes.Status404NotFound)] [ProducesResponseType(StatusCodes.Status404NotFound)]
[ProducesResponseType(typeof(string), StatusCodes.Status500InternalServerError)] [ProducesResponseType(typeof(string), StatusCodes.Status500InternalServerError)]
public IActionResult GetTask([FromRoute] string taskId) public IActionResult GetTask([FromRoute] string taskId)
{
try
{ {
var task = _taskManager.ScheduledTasks.FirstOrDefault(i => var task = _taskManager.ScheduledTasks.FirstOrDefault(i =>
string.Equals(i.Id, taskId, StringComparison.OrdinalIgnoreCase)); string.Equals(i.Id, taskId, StringComparison.OrdinalIgnoreCase));
@ -109,11 +100,6 @@ namespace Jellyfin.Api.Controllers
var result = ScheduledTaskHelpers.GetTaskInfo(task); var result = ScheduledTaskHelpers.GetTaskInfo(task);
return Ok(result); return Ok(result);
} }
catch (Exception e)
{
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
}
}
/// <summary> /// <summary>
/// Start specified task. /// Start specified task.
@ -125,8 +111,6 @@ namespace Jellyfin.Api.Controllers
[ProducesResponseType(StatusCodes.Status404NotFound)] [ProducesResponseType(StatusCodes.Status404NotFound)]
[ProducesResponseType(typeof(string), StatusCodes.Status500InternalServerError)] [ProducesResponseType(typeof(string), StatusCodes.Status500InternalServerError)]
public IActionResult StartTask([FromRoute] string taskId) public IActionResult StartTask([FromRoute] string taskId)
{
try
{ {
var task = _taskManager.ScheduledTasks.FirstOrDefault(o => var task = _taskManager.ScheduledTasks.FirstOrDefault(o =>
o.Id.Equals(taskId, StringComparison.OrdinalIgnoreCase)); o.Id.Equals(taskId, StringComparison.OrdinalIgnoreCase));
@ -139,11 +123,6 @@ namespace Jellyfin.Api.Controllers
_taskManager.Execute(task, new TaskOptions()); _taskManager.Execute(task, new TaskOptions());
return Ok(); return Ok();
} }
catch (Exception e)
{
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
}
}
/// <summary> /// <summary>
/// Stop specified task. /// Stop specified task.
@ -155,8 +134,6 @@ namespace Jellyfin.Api.Controllers
[ProducesResponseType(StatusCodes.Status404NotFound)] [ProducesResponseType(StatusCodes.Status404NotFound)]
[ProducesResponseType(typeof(string), StatusCodes.Status500InternalServerError)] [ProducesResponseType(typeof(string), StatusCodes.Status500InternalServerError)]
public IActionResult StopTask([FromRoute] string taskId) public IActionResult StopTask([FromRoute] string taskId)
{
try
{ {
var task = _taskManager.ScheduledTasks.FirstOrDefault(o => var task = _taskManager.ScheduledTasks.FirstOrDefault(o =>
o.Id.Equals(taskId, StringComparison.OrdinalIgnoreCase)); o.Id.Equals(taskId, StringComparison.OrdinalIgnoreCase));
@ -169,11 +146,6 @@ namespace Jellyfin.Api.Controllers
_taskManager.Cancel(task); _taskManager.Cancel(task);
return Ok(); return Ok();
} }
catch (Exception e)
{
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
}
}
/// <summary> /// <summary>
/// Update specified task triggers. /// Update specified task triggers.
@ -185,9 +157,9 @@ namespace Jellyfin.Api.Controllers
[ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status404NotFound)] [ProducesResponseType(StatusCodes.Status404NotFound)]
[ProducesResponseType(typeof(string), StatusCodes.Status500InternalServerError)] [ProducesResponseType(typeof(string), StatusCodes.Status500InternalServerError)]
public IActionResult UpdateTask([FromRoute] string taskId, [FromBody, BindRequired] TaskTriggerInfo[] triggerInfos) public IActionResult UpdateTask(
{ [FromRoute] string taskId,
try [FromBody, BindRequired] TaskTriggerInfo[] triggerInfos)
{ {
var task = _taskManager.ScheduledTasks.FirstOrDefault(o => var task = _taskManager.ScheduledTasks.FirstOrDefault(o =>
o.Id.Equals(taskId, StringComparison.OrdinalIgnoreCase)); o.Id.Equals(taskId, StringComparison.OrdinalIgnoreCase));
@ -199,10 +171,5 @@ namespace Jellyfin.Api.Controllers
task.Triggers = triggerInfos; task.Triggers = triggerInfos;
return Ok(); return Ok();
} }
catch (Exception e)
{
return StatusCode(StatusCodes.Status500InternalServerError, e.Message);
}
}
} }
} }