Uh oh!
There was an error while loading. Please reload this page.
Enable error handling in Java WebClient library, fixes #1243 - #1244
Conversation
wing328
commented
Oct 21, 2018
Thanks for the PR but your commit (as shown in the Commits tab) is not linked to your Github account, which means this PR won't count as your contribution in https://github.com/OpenAPITools/openapi-generator/graphs/contributors. Let me know if you need help fixing it. |
wing328
commented
Oct 21, 2018
cc @daonomic who's added the WebClient support. |
lukstei
commented
Oct 21, 2018
Thanks for the info - fixed it |
Spring has a built-in |
Actually I think this all should be simplified to: returnrequestBuilder.retrieve().bodyToMono(returnType);which should throw a WebClientResponseException if the status code is 4xx or 5xx |
lukstei
commented
Dec 6, 2018
@cbornet yes you are right it is handled when calling retrieve() instead of exchange() (see DefaultWebClient:374). So this custom error handling can be removed altogether. I will do this. Two further questions arised:
|
cbornet
commented
Dec 6, 2018
IMO we should remove all the logic and not use ApiException as it doesn't add any value. Also I think WebClient users would expect WebClientResponseException if something went wrong. |
lukstei
commented
Dec 9, 2018
I removed all the logic, which makes it much more cleaner now and also solves the initial issue #1243. The question whether we should use the @cbornet thank you for the input. |
LGTM 👍 |
cbornet
commented
Dec 9, 2018
As for ApiException it could be used to replace the RuntimeException that are thrown at some places of the code. |
* master: (40 commits) [Python] remove default value from being fallback to example (#2213) Add petstore integration tests to Ruby OAS3 client (#2211) Gradle - make GenerateTask properties optional (#2185) skip bats installation (#2198) Something in the dependencies changed. This switch is no longer needed. (#1850) Use oauth token for basic bearer auth in Rust. (#2161) Fix missing nullable (#2189) Enable error handling in Java WebClient library, fixes#1243 (#1244) [core] fix referenced enum case (#2175) rest-template: allow array parameters in path using collectionFormat (#2177) update go petstore samples Fix string types for cpprestsdk client generator (#1676) update kotline samples Remove API Key Authentication code for go when cookie is used. (#1601) changed the package install instructions to install the .tgz package … (#1989) okhttp-gson: allow array parameters in path using collectionFormat (#2137) [Ruby] Fix regualr expression in error message (#2069) (#2139) [kotlin][client] bytearray conversion (#2166) [rust-server] Added client documentation to rust-server (#2159) [Java] Getter/Setter naming convention not followed in generated models (#2095) ...
PR checklist
./bin/to update Petstore sample so that CIs can verify the change. (For instance, only need to run./bin/{LANG}-petstore.shand./bin/security/{LANG}-petstore.shif updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in.\bin\windows\.master,3.4.x,4.0.x. Default:master.Description of the PR
Enable error handling in Java WebClient library, fixes#1243.
Also now the generated Exception class
ApiExceptionis used.Custom error handling behaviour can be defined in an overwriting class e.g.:
@bbdouglas@JFCote@sreeshas@jfiala@lukoyanov@cbornet@jeff9finger