Skip to content

Commit

Permalink
Merge branch 'master' into format_keystroke
Browse files Browse the repository at this point in the history
  • Loading branch information
DustinCampbell committed Dec 5, 2017
2 parents 7fea1ad + 099a2c1 commit 2b1fa3e
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/OmniSharp.Stdio/Host.cs
Expand Up @@ -9,6 +9,7 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using OmniSharp.Endpoint;
using OmniSharp.Mef;
using OmniSharp.Models.UpdateBuffer;
Expand Down Expand Up @@ -160,6 +161,11 @@ public void Start()
}
catch (Exception e)
{
if (e is AggregateException aggregateEx)
{
e = aggregateEx.Flatten().InnerException;
}
_writer.WriteLine(new EventPacket()
{
Event = "error",
Expand Down Expand Up @@ -218,6 +224,11 @@ private async Task HandleRequest(string json, ILogger logger)
}
catch (Exception e)
{
if (e is AggregateException aggregateEx)
{
e = aggregateEx.Flatten().InnerException;
}

// updating the response object here so that the ResponseStream
// prints the latest state when being closed
response.Success = false;
Expand All @@ -241,7 +252,7 @@ void LogRequest(string json, ILogger logger)
try
{
builder.AppendLine("************ Request ************");
builder.Append(json);
builder.Append(JToken.Parse(json).ToString(Formatting.Indented));
logger.LogDebug(builder.ToString());
}
finally
Expand All @@ -256,7 +267,7 @@ void LogResponse(string json, ILogger logger)
try
{
builder.AppendLine("************ Response ************ ");
builder.Append(json);
builder.Append(JToken.Parse(json).ToString(Formatting.Indented));
logger.LogDebug(builder.ToString());
}
finally
Expand Down

1 comment on commit 2b1fa3e

@Pmarc78
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks

Please sign in to comment.