-
Notifications
You must be signed in to change notification settings - Fork 217
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
C# - Kiota swallows exception body when undocumented exception is thrown #3964
Comments
Would you be OK with the response body as a string? We can't return the native type as we don't want to take a dependency on it. |
Yes a simple string in the exception would help alot. |
@darrelmiller what would you want to be done when the payload is large and/or is "not a string"? (let's imagine the client gets an image back). |
@baywet would be awesome if you could give me an example of how to do it. I tried to do it with the ResponseHandler but this leads to additional code that I need to put into every request because it does not return a value even if the request is successful. |
Here is an example of the retry handler I suggest you implement a "Default Error Mapping option & handler". The option would contain a dictionary of status code and type mapping. Then you'd need to build your http client by inserting your new middleware in the collection And lastly, when you make your request with the fluent API, you can pass the option thanks to the request configuration ( |
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. |
1 similar comment
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. |
When no errorMapping exists, the response body does not get included in the thrown ApiExcepion:
https://github.com/microsoft/kiota-http-dotnet/blob/3c35d1c3c350c4b208e46b7c8bf8c93d518df916/src/HttpClientRequestAdapter.cs#L399C31-L399C31
I think you should include the full HttpResponseMessage as it is really helpful if you face undocumented exceptions.
The text was updated successfully, but these errors were encountered: