Skip to content

Commit 2b1fa3e

Browse files
Merge branch 'master' into format_keystroke
2 parents 7fea1ad + 099a2c1 commit 2b1fa3e

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/OmniSharp.Stdio/Host.cs

+13-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using Microsoft.Extensions.Configuration;
1010
using Microsoft.Extensions.Logging;
1111
using Newtonsoft.Json;
12+
using Newtonsoft.Json.Linq;
1213
using OmniSharp.Endpoint;
1314
using OmniSharp.Mef;
1415
using OmniSharp.Models.UpdateBuffer;
@@ -160,6 +161,11 @@ public void Start()
160161
}
161162
catch (Exception e)
162163
{
164+
if (e is AggregateException aggregateEx)
165+
{
166+
e = aggregateEx.Flatten().InnerException;
167+
}
168+
163169
_writer.WriteLine(new EventPacket()
164170
{
165171
Event = "error",
@@ -218,6 +224,11 @@ private async Task HandleRequest(string json, ILogger logger)
218224
}
219225
catch (Exception e)
220226
{
227+
if (e is AggregateException aggregateEx)
228+
{
229+
e = aggregateEx.Flatten().InnerException;
230+
}
231+
221232
// updating the response object here so that the ResponseStream
222233
// prints the latest state when being closed
223234
response.Success = false;
@@ -241,7 +252,7 @@ void LogRequest(string json, ILogger logger)
241252
try
242253
{
243254
builder.AppendLine("************ Request ************");
244-
builder.Append(json);
255+
builder.Append(JToken.Parse(json).ToString(Formatting.Indented));
245256
logger.LogDebug(builder.ToString());
246257
}
247258
finally
@@ -256,7 +267,7 @@ void LogResponse(string json, ILogger logger)
256267
try
257268
{
258269
builder.AppendLine("************ Response ************ ");
259-
builder.Append(json);
270+
builder.Append(JToken.Parse(json).ToString(Formatting.Indented));
260271
logger.LogDebug(builder.ToString());
261272
}
262273
finally

0 commit comments

Comments
 (0)