Don't swallow too many exceptions

- Swallowing too many exceptions can end up hiding issues in
  Kestrel itself. It's better to let the process die.
- If we want to handle certain exceptions we should be as
  specific as possible with our try/catch blocks.
This commit is contained in:
Stephen Halter 2015-09-10 12:23:56 -07:00
parent 2e225b0db6
commit f14af1f409
5 changed files with 7 additions and 0 deletions

View File

@ -93,6 +93,7 @@ namespace Microsoft.AspNet.Server.Kestrel.Http
catch (Exception ex) catch (Exception ex)
{ {
Log.LogError("Connection._frame.Consume ", ex); Log.LogError("Connection._frame.Consume ", ex);
throw;
} }
} }

View File

@ -276,6 +276,7 @@ namespace Microsoft.AspNet.Server.Kestrel
else else
{ {
_log.LogError("KestrelThread.DoPostWork", ex); _log.LogError("KestrelThread.DoPostWork", ex);
throw;
} }
} }
} }
@ -299,6 +300,7 @@ namespace Microsoft.AspNet.Server.Kestrel
catch (Exception ex) catch (Exception ex)
{ {
_log.LogError("KestrelThread.DoPostCloseHandle", ex); _log.LogError("KestrelThread.DoPostCloseHandle", ex);
throw;
} }
} }
} }

View File

@ -67,6 +67,7 @@ namespace Microsoft.AspNet.Server.Kestrel.Networking
catch (Exception ex) catch (Exception ex)
{ {
req._log.LogError("UvConnectRequest", ex); req._log.LogError("UvConnectRequest", ex);
throw;
} }
} }
} }

View File

@ -133,6 +133,7 @@ namespace Microsoft.AspNet.Server.Kestrel.Networking
catch (Exception ex) catch (Exception ex)
{ {
stream._log.LogError("UvConnectionCb", ex); stream._log.LogError("UvConnectionCb", ex);
throw;
} }
} }
@ -172,6 +173,7 @@ namespace Microsoft.AspNet.Server.Kestrel.Networking
catch (Exception ex) catch (Exception ex)
{ {
stream._log.LogError("UbReadCb", ex); stream._log.LogError("UbReadCb", ex);
throw;
} }
} }

View File

@ -167,6 +167,7 @@ namespace Microsoft.AspNet.Server.Kestrel.Networking
catch (Exception ex) catch (Exception ex)
{ {
req._log.LogError("UvWriteCb", ex); req._log.LogError("UvWriteCb", ex);
throw;
} }
} }
} }