Unexpected request handler errors no longer crash SQL Tools Service (#591)

* Handler errors no longer crash service

* Disable additional flaky test
This commit is contained in:
Matt Irvine
2018-03-15 14:14:09 -07:00
committed by GitHub
parent 62a519cab5
commit aaa3513db2
3 changed files with 8 additions and 7 deletions

View File

@@ -307,13 +307,12 @@ namespace Microsoft.SqlTools.Hosting.Protocol
// Some tasks may be cancelled due to legitimate
// timeouts so don't let those exceptions go higher.
}
catch (AggregateException e)
catch (Exception e)
{
if (!(e.InnerExceptions[0] is TaskCanceledException))
if (!(e is AggregateException && ((AggregateException)e).InnerExceptions[0] is TaskCanceledException))
{
// Cancelled tasks aren't a problem, so rethrow
// anything that isn't a TaskCanceledException
throw e;
// Log the error but don't rethrow it to prevent any errors in the handler from crashing the service
Logger.Write(LogLevel.Error, string.Format("An unexpected error occured in the request handler: {0}", e.ToString()));
}
}
}