-
Notifications
You must be signed in to change notification settings - Fork 252
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
Override Message property of ODataError to show error code and error message #2094
Comments
How does the PR fix this issue? I still see e.g. |
Any chance you can share the sample code when the error is thrown @macwier ? |
var users = new List<User>();
var response = await GraphServiceClient.Groups[groupId].TransitiveMembers
.GraphUser
.GetAsync(x => x.QueryParameters.Select = new[]
{ "id", "displayName", "mail", "otherMails", "userPrincipalName", "accountEnabled", "proxyAddresses", "officeLocation" });
var pageIterator = PageIterator<User, UserCollectionResponse>.CreatePageIterator(
GraphServiceClient, response, (user) => { users.Add(user); return true; });
await pageIterator.IterateAsync();
return users; The problem is that this happens only for one particular group (we use that code on multiple AADs and all works ok, except one particular group within one AAD). I know that the group has members, but I don't actually have access to authorize as the service principal and debug the code (this happens in production). So the problem is, I'm getting an error, but I don't know what it is about, beside it being http status 400. I was hoping that this would give me the body of the response in the logs (i.e. when doing |
This is a separate issue. Created microsoftgraph/msgraph-sdk-dotnet-core#728 to track this. |
Since SDK v5 has been released I see on StackOverflow and Microsoft Q&A that many developers are confused about
ODataError
.When the Graph API service returns the
ODataError
error and theMessage
property displays text Exception of type 'Microsoft.Graph.Models.ODataErrors.ODataError' was thrown. This description is useless for the developers.The message should show at least the error code and the error message.
Describe the solution you'd like
I would suggest to generate overriden
Message
property of theODataError
Describe alternatives you've considered
Another alternative was to override
ToString
methodAdditional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: