Describe the bug
We are using the DriveItemRequestBuilder.GetAsync method. From our logs, the MS Graph API returned a 503 on the request. We have a try catch around the DriveItemRequestBuilder.GetAsync method with a catch for ODataError, but this catch wasn't executed. The method threw an ApiException instead and we got the following stack trace:
Microsoft.Kiota.Abstractions.ApiException: The server returned an unexpected status code and the error registered for this code failed to deserialize: 503\r\n at Microsoft.Kiota.Http.HttpClientLibrary.HttpClientRequestAdapter.ThrowIfFailedResponse(HttpResponseMessage response, Dictionary2 errorMapping, Activity activityForAttributes, CancellationToken cancellationToken)\r\n at Microsoft.Kiota.Http.HttpClientLibrary.HttpClientRequestAdapter.SendAsync[ModelType](RequestInformation requestInfo, ParsableFactory1 factory, Dictionary2 errorMapping, CancellationToken cancellationToken)\r\n at Microsoft.Kiota.Http.HttpClientLibrary.HttpClientRequestAdapter.SendAsync[ModelType](RequestInformation requestInfo, ParsableFactory1 factory, Dictionary2 errorMapping, CancellationToken cancellationToken)\r\n at Microsoft.Graph.Shares.Item.DriveItem.DriveItemRequestBuilder.GetAsync(Action1 requestConfiguration, CancellationToken cancellationToken)\r\n
The error message is coming from Kiota: https://github.com/microsoft/kiota-http-dotnet/blob/c1c295d3b0ebb2182b66d9a6858241117b59b540/src/HttpClientRequestAdapter.cs#L415C1-L416C1
Please let me know if there is any additional I can provide. Thanks!
Expected behavior
We would expect the 503 to return as an OData Error, or confirm whether the intended behavior instead is for errors to throw an ApiException instead.
How to reproduce
The repro would involve calling the DriveItemRequestBuilder.GetAsync method and mocking a 503 response from Graph API.
SDK Version
5.41.0
Latest version known to work for scenario above?
No response
Known Workarounds
No response
Debug output
No response
Configuration
No response
Other information
No response
Describe the bug
We are using the DriveItemRequestBuilder.GetAsync method. From our logs, the MS Graph API returned a 503 on the request. We have a try catch around the DriveItemRequestBuilder.GetAsync method with a catch for ODataError, but this catch wasn't executed. The method threw an ApiException instead and we got the following stack trace:
Microsoft.Kiota.Abstractions.ApiException: The server returned an unexpected status code and the error registered for this code failed to deserialize: 503\r\n at Microsoft.Kiota.Http.HttpClientLibrary.HttpClientRequestAdapter.ThrowIfFailedResponse(HttpResponseMessage response, Dictionary
2 errorMapping, Activity activityForAttributes, CancellationToken cancellationToken)\r\n at Microsoft.Kiota.Http.HttpClientLibrary.HttpClientRequestAdapter.SendAsync[ModelType](RequestInformation requestInfo, ParsableFactory1 factory, Dictionary2 errorMapping, CancellationToken cancellationToken)\r\n at Microsoft.Kiota.Http.HttpClientLibrary.HttpClientRequestAdapter.SendAsync[ModelType](RequestInformation requestInfo, ParsableFactory1 factory, Dictionary2 errorMapping, CancellationToken cancellationToken)\r\n at Microsoft.Graph.Shares.Item.DriveItem.DriveItemRequestBuilder.GetAsync(Action1 requestConfiguration, CancellationToken cancellationToken)\r\nThe error message is coming from Kiota: https://github.com/microsoft/kiota-http-dotnet/blob/c1c295d3b0ebb2182b66d9a6858241117b59b540/src/HttpClientRequestAdapter.cs#L415C1-L416C1
Please let me know if there is any additional I can provide. Thanks!
Expected behavior
We would expect the 503 to return as an OData Error, or confirm whether the intended behavior instead is for errors to throw an ApiException instead.
How to reproduce
The repro would involve calling the DriveItemRequestBuilder.GetAsync method and mocking a 503 response from Graph API.
SDK Version
5.41.0
Latest version known to work for scenario above?
No response
Known Workarounds
No response
Debug output
No response
Configuration
No response
Other information
No response