|
|
|
@ -284,6 +284,8 @@ namespace MediaBrowser.Server.Implementations.HttpServer
|
|
|
|
|
|
|
|
|
|
RaiseReceiveWebRequest(context);
|
|
|
|
|
|
|
|
|
|
await Task.Run(() =>
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
ProcessRequest(context);
|
|
|
|
@ -291,49 +293,36 @@ namespace MediaBrowser.Server.Implementations.HttpServer
|
|
|
|
|
catch (InvalidOperationException ex)
|
|
|
|
|
{
|
|
|
|
|
HandleException(context.Response, ex, 422);
|
|
|
|
|
|
|
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
catch (ResourceNotFoundException ex)
|
|
|
|
|
{
|
|
|
|
|
HandleException(context.Response, ex, 404);
|
|
|
|
|
|
|
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
catch (FileNotFoundException ex)
|
|
|
|
|
{
|
|
|
|
|
HandleException(context.Response, ex, 404);
|
|
|
|
|
|
|
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
catch (DirectoryNotFoundException ex)
|
|
|
|
|
{
|
|
|
|
|
HandleException(context.Response, ex, 404);
|
|
|
|
|
|
|
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
catch (UnauthorizedAccessException ex)
|
|
|
|
|
{
|
|
|
|
|
HandleException(context.Response, ex, 401);
|
|
|
|
|
|
|
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
catch (ArgumentException ex)
|
|
|
|
|
{
|
|
|
|
|
HandleException(context.Response, ex, 400);
|
|
|
|
|
|
|
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
HandleException(context.Response, ex, 500);
|
|
|
|
|
|
|
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
context.Response.Close();
|
|
|
|
|
}
|
|
|
|
|
}).ConfigureAwait(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|