-
Notifications
You must be signed in to change notification settings - Fork 726
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
Return the body of HttpOperationExceptions (to view the detail) #931
Comments
I agree! :-) See #693 (comment) |
@stankovski thoughts? |
Example #2 (As Delete isn't finished yet so not a fair test) |
If the swagger is modeled to deserialize the errors correctly, then the generated code will honor that. |
@amarzavery That's true. But if you're consuming an API you don't control you can't fix that easily. As I mentioned in #693 AutoRest is punishing the consumer for a producer's mistake; which runs against a common RESTful philopsophy: favour the consumer over the producer. AFAIK it's not easy to specify the error type in Swashbuckle (you need a SchemaFilter to add the error type, and then (IIRC) an OperationFilter), which means you'll be seeing more of these requests :-) |
@koolraap That philosophy is interesting but I can't find it on searching, On Wed, Apr 13, 2016 at 1:58 PM, koolraap notifications@github.com wrote:
|
It would make sense to me to include common http information in an exception by default. |
@brodyberg I wrote the API design guidelines where I work, and favour the consumer is point #1 :-) I read a bunch of (conflicting) REST best practice guideines prior to that. It was mentioned fairly regularly. Here's an example http://www.restapitutorial.com/media/RESTful_Best_Practices-v1_1.pdf |
+1 having this same problem. The C# code generated by AutoRest looks something like this:
The HttpResposne is available to the caller, but after the response gets wrapped by HttpResponseMessageWrapper, the body is not available - it should be made available to the caller to manually extract anything they need to get to. |
Any word on this? |
If I could get the source to build I would pull request the change to: For "default:" non-200 responses:
|
Howdy! In our planning for driving towards a stable '1.0' release, I'm marking this issue as 'deferred' 💤 and we're going to review it during the post-1.0 planning cycle. It's not to say that we're not going to work on it, or that this isn't not important, but at the moment, we're picking and choosing the stuff we must do before 1.0. 🏇 🏇 🏇 We'll make sure we pick this back up at that point. 🎉 |
@fearthecowboy Any news on if/when this will be added? |
Eagerly awaiting for this to be in the roadmap (1.1?) |
Looks like you can
|
Still not loving this :( |
Given I use an Azure Rest NuGet (e.g. Power BI)
When an HttpOperationException occurs
Then I want the body of the response
For example
client.Datasets.DeleteDatasetByIdAsync("BAD", "Missing", "None");
Returns "Operation returned an invalid status code 'Unauthorized'" but using Fiddler I can see there is a more detailed error.
62 {"error":{"code":"UnknownError","pbi.error":{"code":"UnknownError","parameters":{},"details":[]}}} 0
This is also true for other requests that are 404 / 500
This is not just for Power BI
The text was updated successfully, but these errors were encountered: