So, I'm trying to query cosmos collection for a specific document, with the following line of code:
FeedIterator<dynamic> querieditem = container.GetItemQueryIterator<dynamic>(mysqlquery);
When there exists an item in the database, this goes without any problems. However, when there doesn't exist any match in the database, I get the following exception:
System.Private.CoreLib: Exception while executing function: TestFunction. Microsoft.Azure.Cosmos.Client: Response status code does not indicate success: NotFound (404); Substatus: 0; ActivityId:123123; Reason: (Message: {"Errors":["Resource Not Found. Learn more: https://aka.ms/cosmosdb-tsg-not-found"]}
Does this really mean, that I need to add a try/catch, in case GetItemQueryIterator()
can't find anything in Cosmos? Given that it is necessary, why does this make sense?