Better error messages for queries
thomaslevesque opened this issue · comments
Thomas Levesque commented
Errors returned by Cosmos DB are pure cr*p. Here's an exemple of the body of an error response (formatted):
{
"code": "BadRequest",
"message": "Gateway Failed to Retrieve Query Plan: Message: {\"errors\":[{\"severity\":\"Error\",\"location\":{\"start\":36,\"end\":36},\"code\":\"SC1002\",\"message\":\"Syntax error, unexpected end-of-file.\"}]}\r\nActivityId: 3d7a2504-ea2b-4075-a957-0ca8e4ae05f8, Microsoft.Azure.Documents.Common/2.11.0, Microsoft.Azure.Documents.Common/2.11.0"
}
The message content is plain text, with some JSON in the middle of it. It's unreadable, and the actual error data is difficult to extract.
It would be nice to parse this mess, display a clear error message, and show error squiggles in the editor at the specified location.
Thomas Levesque commented
Related: Azure/azure-cosmos-dotnet-v3#1910