-
Notifications
You must be signed in to change notification settings - Fork 566
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
#859 Add error-handling best practice in quickstart-se #860
Conversation
Hi @camerondurham, the version change part of your PR is not valid. The examples in the master branch depend on the current SNAPSHOT version and thus require a full build. |
HI @romain-grecourt , thank you for the update. Should I instead remove this request and make only the |
Yes, go ahead. |
@romain-grecourt My PR now only updates the quickstart. |
There are a couple of issues with your suggested change.
Here is what I came up with: request.content().as(JsonObject.class)
.thenAccept(jo -> updateGreetingFromJson(jo, response))
.exceptionally((Throwable ex) -> {
if (ex.getCause() instanceof JsonException) {
request.next(new BadRequestException("Invalid JSON",
(JsonException) ex.getCause()));
} else {
request.next(ex);
}
return null;
}); @tomas-langer thoughts ? |
Thanks for pointing out those issues. Of course, I agree that your change is much more effective. Sorry for being unfamiliar with this process, but would you be making this change yourself or should I modify my PR? @romain-grecourt |
Ideally you'd make this change in your PR so that you could get a Helidon contrib under your Belt. |
@barchetta @tomas-langer Any thoughts on the suggested changes ? |
Thanks, that sounds great. I'm adding @namanshenoy to my fork since he's another Oracle employee I worked with on this. |
...arts/helidon-quickstart-se/src/main/java/io/helidon/examples/quickstart/se/GreetService.java
Outdated
Show resolved
Hide resolved
...arts/helidon-quickstart-se/src/main/java/io/helidon/examples/quickstart/se/GreetService.java
Outdated
Show resolved
Hide resolved
...arts/helidon-quickstart-se/src/main/java/io/helidon/examples/quickstart/se/GreetService.java
Outdated
Show resolved
Hide resolved
...arts/helidon-quickstart-se/src/main/java/io/helidon/examples/quickstart/se/GreetService.java
Outdated
Show resolved
Hide resolved
...arts/helidon-quickstart-se/src/main/java/io/helidon/examples/quickstart/se/GreetService.java
Outdated
Show resolved
Hide resolved
...arts/helidon-quickstart-se/src/main/java/io/helidon/examples/quickstart/se/GreetService.java
Outdated
Show resolved
Hide resolved
...arts/helidon-quickstart-se/src/main/java/io/helidon/examples/quickstart/se/GreetService.java
Outdated
Show resolved
Hide resolved
...arts/helidon-quickstart-se/src/main/java/io/helidon/examples/quickstart/se/GreetService.java
Outdated
Show resolved
Hide resolved
@tomas-langer What do you think about returning the exception message in the response body ? |
...arts/helidon-quickstart-se/src/main/java/io/helidon/examples/quickstart/se/GreetService.java
Outdated
Show resolved
Hide resolved
...arts/helidon-quickstart-se/src/main/java/io/helidon/examples/quickstart/se/GreetService.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I approved by mistake ; the error handling needs to be refined.
...arts/helidon-quickstart-se/src/main/java/io/helidon/examples/quickstart/se/GreetService.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, @tomas-langer @barchetta can you guys take a look ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Closes my issue #859 in
examples/quickstarts/helidon-quickstart-se