mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-16 18:47:57 -05:00
Fixing issue where error objects were not serialized with camelcase property names (#360)
This commit is contained in:
@@ -6,6 +6,7 @@
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.SqlTools.Hosting.Contracts;
|
||||||
using Microsoft.SqlTools.Hosting.Protocol.Contracts;
|
using Microsoft.SqlTools.Hosting.Protocol.Contracts;
|
||||||
using Microsoft.SqlTools.Hosting.Protocol.Serializers;
|
using Microsoft.SqlTools.Hosting.Protocol.Serializers;
|
||||||
using Microsoft.SqlTools.Utility;
|
using Microsoft.SqlTools.Utility;
|
||||||
@@ -132,6 +133,12 @@ namespace Microsoft.SqlTools.Hosting.Protocol
|
|||||||
contentObject));
|
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
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,11 +47,10 @@ namespace Microsoft.SqlTools.Hosting.Protocol
|
|||||||
Message = errorMessage,
|
Message = errorMessage,
|
||||||
Code = errorCode
|
Code = errorCode
|
||||||
};
|
};
|
||||||
return this.messageWriter.WriteMessage(
|
return this.messageWriter.WriteError(
|
||||||
Message.ResponseError(
|
|
||||||
requestMessage.Id,
|
requestMessage.Id,
|
||||||
requestMessage.Method,
|
requestMessage.Method,
|
||||||
JToken.FromObject(error)));
|
error);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual Task SendError(Exception e)
|
public virtual Task SendError(Exception e)
|
||||||
|
|||||||
Reference in New Issue
Block a user