aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/HttpServer/HttpServer.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2013-04-15 22:36:12 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2013-04-15 22:36:12 -0400
commitf1dba04767940959815fbc2029797fbf25d8f2f5 (patch)
treee43d5ace8c7dd7604172834ac69294a3f5f3d330 /MediaBrowser.Server.Implementations/HttpServer/HttpServer.cs
parent540fb09f39a931a0127b755d93d452cf08ed6ada (diff)
better progress display
Diffstat (limited to 'MediaBrowser.Server.Implementations/HttpServer/HttpServer.cs')
-rw-r--r--MediaBrowser.Server.Implementations/HttpServer/HttpServer.cs87
1 files changed, 38 insertions, 49 deletions
diff --git a/MediaBrowser.Server.Implementations/HttpServer/HttpServer.cs b/MediaBrowser.Server.Implementations/HttpServer/HttpServer.cs
index 9637817ce..913e2be59 100644
--- a/MediaBrowser.Server.Implementations/HttpServer/HttpServer.cs
+++ b/MediaBrowser.Server.Implementations/HttpServer/HttpServer.cs
@@ -284,56 +284,45 @@ namespace MediaBrowser.Server.Implementations.HttpServer
RaiseReceiveWebRequest(context);
- try
- {
- ProcessRequest(context);
- }
- 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)
+ await Task.Run(() =>
{
- HandleException(context.Response, ex, 500);
-
- throw;
- }
- finally
- {
- context.Response.Close();
- }
+ try
+ {
+ ProcessRequest(context);
+ }
+ catch (InvalidOperationException ex)
+ {
+ HandleException(context.Response, ex, 422);
+ }
+ catch (ResourceNotFoundException ex)
+ {
+ HandleException(context.Response, ex, 404);
+ }
+ catch (FileNotFoundException ex)
+ {
+ HandleException(context.Response, ex, 404);
+ }
+ catch (DirectoryNotFoundException ex)
+ {
+ HandleException(context.Response, ex, 404);
+ }
+ catch (UnauthorizedAccessException ex)
+ {
+ HandleException(context.Response, ex, 401);
+ }
+ catch (ArgumentException ex)
+ {
+ HandleException(context.Response, ex, 400);
+ }
+ catch (Exception ex)
+ {
+ HandleException(context.Response, ex, 500);
+ }
+ finally
+ {
+ context.Response.Close();
+ }
+ }).ConfigureAwait(false);
}
/// <summary>