October 9th, 2024

Debug Queries More Efficiently with the Improved Error Messaging in Azure Cosmos DB Data Explorer

Meredith Moore
Senior Product Manager

Azure Cosmos DB Data Explorer is a web-based tool available in the Azure Portal that allows you to manage data, as well as track and fix issues with your queries. In this blog post, we will focus on some of the new features in data explorer that improve the error messaging in the query editor, making it easier for you to debug queries in Azure Cosmos DB.  These were developed in response to user feedback through our NPS survey. To share feedback, click the Feedback icon in the Azure portal on any Cosmos DB blade, or submit it through the Net Promotor Score (NPS) survey.

Improving the error message for complete display that’s clear for the user

Azure cosmos db data explorer error message
Azure cosmos db data explorer error message

One of the common challenges when writing queries in Azure Cosmos DB is dealing with syntax errors in the query itself, such as invalid operators, parameters, or typos.  These errors can prevent your query from running or returning the expected results. Previously, Data Explorer would display a generic error message that was often truncated and not very informative, such as “BadRequest, one of the input values is invalid” This made it difficult to identify and fix the error, especially if your query was long or complex.

Now, Data Explorer has improved the error message to be more user-friendly and helpful. The error message is displayed in a separate panel below the query editor, and it is not truncated, so you can see the full details of the error. The error message also highlights the exact location of the error in the query, using a red squiggle and a line number. This way, you can quickly locate and correct the error, and run your query again.

F8 keyboard shortcut to click through multiple errors

Sometimes, your query may have more than one error.  In that case, it can be tedious to scroll through the query editor and look for the red squiggles and the error messages. To make it easier for you to navigate through the errors, Data Explorer now supports the F8 keyboard shortcut. When you press F8, the query editor will move the cursor to the next error in the query, and show the corresponding error message in the panel below. You can press F8 repeatedly to cycle through all the errors in the query and fix them one by one. This way, you can save time and effort and write and debug queries more efficiently.

Customize error messages to align with developer expectations

Finally, data explorer has improved the format of the error message to match the developer expectations and the industry standards. The error message now follows the format of compiler errors, which are widely used and understood by developers. The error message has four parts: the error code, type, message, and location. For example, the error message for an invalid operator would look like this: “SC1001: Syntax error: Invalid operator ‘==’. Did you mean ‘=’? Line 3, Position 15.” This format makes it easier for you to comprehend and fix the error, as well as to search for more information or assistance online.

Conclusion

We hope that these new features in Cosmos DB data explorer will help you to write and debug queries more easily and efficiently. We are always working to improve the user experience and the functionality of Data Explorer, and we welcome your feedback and suggestions. You can submit your feedback through Data Explorer itself, by clicking on the feedback button on the top right corner. Happy querying!

Additional Azure Cosmos DB Data Explorer Improvements from your NPS feedback

Leave a review

Tell us about your Azure Cosmos DB experience! Leave a review on PeerSpot and we’ll gift you $50. Get started here.

About Azure Cosmos DB

Azure Cosmos DB is a fully managed and serverless NoSQL and vector database for modern app development, including AI applications. With its SLA-backed speed and availability as well as instant dynamic scalability, it is ideal for real-time NoSQL and MongoDB applications that require high performance and distributed computing over massive volumes of NoSQL and vector data.

Try Azure Cosmos DB for free here. To stay in the loop on Azure Cosmos DB updates, follow us on X, YouTube, and LinkedIn

Author

Meredith Moore
Senior Product Manager

Senior Product Manager for Azure Cosmos DB portal and developer experiences.

0 comments