Fixing issue where error objects were not serialized with camelcase property names (#360)

This commit is contained in:
Benjamin Russell
2017-05-25 17:59:47 -07:00
committed by GitHub
parent 2a1da0ff09
commit c545b74372
2 changed files with 9 additions and 3 deletions

View File

@@ -6,6 +6,7 @@
using System.IO;
using System.Text;
using System.Threading.Tasks;
using Microsoft.SqlTools.Hosting.Contracts;
using Microsoft.SqlTools.Hosting.Protocol.Contracts;
using Microsoft.SqlTools.Hosting.Protocol.Serializers;
using Microsoft.SqlTools.Utility;
@@ -132,6 +133,12 @@ namespace Microsoft.SqlTools.Hosting.Protocol
contentObject));
}
public async Task WriteError(string method, string requestId, Error error)
{
JToken contentObject = JToken.FromObject(error, contentSerializer);
await this.WriteMessage(Message.ResponseError(requestId, method, contentObject));
}
#endregion
}
}

View File

@@ -47,11 +47,10 @@ namespace Microsoft.SqlTools.Hosting.Protocol
Message = errorMessage,
Code = errorCode
};
return this.messageWriter.WriteMessage(
Message.ResponseError(
return this.messageWriter.WriteError(
requestMessage.Id,
requestMessage.Method,
JToken.FromObject(error)));
error);
}
public virtual Task SendError(Exception e)