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

V5 Batch requests error handling #1782

Closed
idealser opened this issue Mar 29, 2023 · 0 comments · Fixed by #1794 or microsoftgraph/msgraph-beta-sdk-dotnet#637
Closed

V5 Batch requests error handling #1782

idealser opened this issue Mar 29, 2023 · 0 comments · Fixed by #1794 or microsoftgraph/msgraph-beta-sdk-dotnet#637
Labels

Comments

@idealser
Copy link
Contributor

V5 introduces a new way to handle errors typically through ODataError object. In V4 we were using ServiceException object for the same purpose. I will provide an example on user fetch.

When you have single operation, calling GetAsync with inexistent user id would raise:

V4: throws ServiceException with ex.Error.Code == Request_ResourceNotFound
V5: throws ODataError with ex.Error.Code == Request_ResourceNotFound

op

But when you execute the same operation in batch, here is the output:

V4: throws ServiceException with ex.Error.Code == Request_ResourceNotFound
V5: throws ServiceException where you don't have an Error object anymore, information now is a part of RawResponseBody which you should deserialize manually.

batch

Is it an expected behaviour? I would expect the batch request to throw the same error as when calling the statement directly, like it was in V4.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
2 participants