diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-04-15 15:09:27 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-04-15 15:09:27 -0400 |
| commit | b838c5301787c181863436d4fc29ae1d61e25522 (patch) | |
| tree | dc703198754e188d8b8cf14d283d8159074eec12 /MediaBrowser.Server.Implementations/HttpServer | |
| parent | 2b8b98b59090ab6d077ac76cf9185da7d6ac126a (diff) | |
reduce uses of Task.Run
Diffstat (limited to 'MediaBrowser.Server.Implementations/HttpServer')
| -rw-r--r-- | MediaBrowser.Server.Implementations/HttpServer/HttpServer.cs | 82 |
1 files changed, 39 insertions, 43 deletions
diff --git a/MediaBrowser.Server.Implementations/HttpServer/HttpServer.cs b/MediaBrowser.Server.Implementations/HttpServer/HttpServer.cs index 4c7dd1da6..87a01ef7d 100644 --- a/MediaBrowser.Server.Implementations/HttpServer/HttpServer.cs +++ b/MediaBrowser.Server.Implementations/HttpServer/HttpServer.cs @@ -282,58 +282,54 @@ namespace MediaBrowser.Server.Implementations.HttpServer return; } + RaiseReceiveWebRequest(context); - Task.Run(() => + try { - RaiseReceiveWebRequest(context); - - try - { - ProcessRequest(context); - } - catch (InvalidOperationException ex) - { - HandleException(context.Response, ex, 422); + ProcessRequest(context); + } + catch (InvalidOperationException ex) + { + HandleException(context.Response, ex, 422); - throw; - } - catch (ResourceNotFoundException ex) - { - HandleException(context.Response, ex, 404); + throw; + } + catch (ResourceNotFoundException ex) + { + HandleException(context.Response, ex, 404); - throw; - } - catch (FileNotFoundException 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 (DirectoryNotFoundException ex) + { + HandleException(context.Response, ex, 404); - throw; - } - catch (UnauthorizedAccessException ex) - { - HandleException(context.Response, ex, 401); + throw; + } + catch (UnauthorizedAccessException ex) + { + HandleException(context.Response, ex, 401); - throw; - } - catch (ArgumentException ex) - { - HandleException(context.Response, ex, 400); + throw; + } + catch (ArgumentException ex) + { + HandleException(context.Response, ex, 400); - throw; - } - catch (Exception ex) - { - HandleException(context.Response, ex, 500); + throw; + } + catch (Exception ex) + { + HandleException(context.Response, ex, 500); - throw; - } - }); + throw; + } } /// <summary> |
