Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DocumentClientException in getCause() in case of exception - Sync Vs Async behavior #128

Open
Ramji-S opened this issue Jan 23, 2019 · 1 comment

Comments

@Ramji-S
Copy link

Ramji-S commented Jan 23, 2019

In case of an Exception, when using the Cosmos DB "Async" API, we could simply catch the generic one and simply do an e.getCause() to see if the instance was of type DocumentClientException. However, when using the DocumentDB Sync, the chain seems to be lengthier. Is this expected ?
Ofcourse, we could use something like Apache common langs 'ExceptionUtils' to check the "Cause", but is this behavior deviation known ? I have a scenario to cast the exception based on the instance check and I use both Sync and Async separately for multiple stuff.

Example:
DocumentDB Sync API ADK:
java.lang.IllegalStateException: java.util.concurrent.ExecutionException: java.lang.IllegalStateException: com.microsoft.azure.documentdb.DocumentClientException: Message: {"Errors":["Owner resource does not exist"]}

CosmosDB Async API SDK:
java.util.concurrent.ExecutionException: com.microsoft.azure.cosmosdb.DocumentClientException: Message: {"Errors":["Owner resource does not exist"]}

@Ramji-S
Copy link
Author

Ramji-S commented Jan 30, 2019

Team - Any updates or response to this please ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant