|
|
|
@ -207,54 +207,58 @@ namespace MediaBrowser.Common.Net
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RaiseReceiveWebRequest(context);
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
ProcessRequest(context);
|
|
|
|
|
}
|
|
|
|
|
catch (InvalidOperationException ex)
|
|
|
|
|
Task.Run(() =>
|
|
|
|
|
{
|
|
|
|
|
HandleException(context.Response, ex, 422);
|
|
|
|
|
RaiseReceiveWebRequest(context);
|
|
|
|
|
|
|
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
catch (ResourceNotFoundException ex)
|
|
|
|
|
{
|
|
|
|
|
HandleException(context.Response, ex, 404);
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
ProcessRequest(context);
|
|
|
|
|
}
|
|
|
|
|
catch (InvalidOperationException ex)
|
|
|
|
|
{
|
|
|
|
|
HandleException(context.Response, ex, 422);
|
|
|
|
|
|
|
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
catch (FileNotFoundException ex)
|
|
|
|
|
{
|
|
|
|
|
HandleException(context.Response, ex, 404);
|
|
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
catch (ResourceNotFoundException ex)
|
|
|
|
|
{
|
|
|
|
|
HandleException(context.Response, ex, 404);
|
|
|
|
|
|
|
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
catch (DirectoryNotFoundException ex)
|
|
|
|
|
{
|
|
|
|
|
HandleException(context.Response, ex, 404);
|
|
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
catch (FileNotFoundException ex)
|
|
|
|
|
{
|
|
|
|
|
HandleException(context.Response, ex, 404);
|
|
|
|
|
|
|
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
catch (UnauthorizedAccessException ex)
|
|
|
|
|
{
|
|
|
|
|
HandleException(context.Response, ex, 401);
|
|
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
catch (DirectoryNotFoundException ex)
|
|
|
|
|
{
|
|
|
|
|
HandleException(context.Response, ex, 404);
|
|
|
|
|
|
|
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
catch (ArgumentException ex)
|
|
|
|
|
{
|
|
|
|
|
HandleException(context.Response, ex, 400);
|
|
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
catch (UnauthorizedAccessException ex)
|
|
|
|
|
{
|
|
|
|
|
HandleException(context.Response, ex, 401);
|
|
|
|
|
|
|
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
HandleException(context.Response, ex, 500);
|
|
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
catch (ArgumentException ex)
|
|
|
|
|
{
|
|
|
|
|
HandleException(context.Response, ex, 400);
|
|
|
|
|
|
|
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
HandleException(context.Response, ex, 500);
|
|
|
|
|
|
|
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|