-
Notifications
You must be signed in to change notification settings - Fork 45
Generate error result types in Dialogue interfaces for endpoints with associated errors #2435
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
Conversation
Generate changelog in
|
a27142a
to
24459fe
Compare
cf12ba8
to
e2e13e6
Compare
e2e13e6
to
692ebf4
Compare
conjure-java-core/src/test/java/com/palantir/conjure/java/UndertowServiceEteTest.java
Outdated
Show resolved
Hide resolved
692ebf4
to
a4ba764
Compare
conjure-java-core/src/integrationInput/java/com/palantir/product/ErrorServiceAsync.java
Outdated
Show resolved
Hide resolved
conjure-java-core/src/integrationInput/java/com/palantir/product/ErrorServiceAsync.java
Outdated
Show resolved
Hide resolved
conjure-lib/src/main/java/com/palantir/conjure/java/lib/internal/ConjureErrors.java
Outdated
Show resolved
Hide resolved
conjure-lib/src/main/java/com/palantir/conjure/java/lib/internal/ConjureErrors.java
Outdated
Show resolved
Hide resolved
conjure-java-core/src/integrationInput/java/com/palantir/product/ErrorServiceBlocking.java
Outdated
Show resolved
Hide resolved
conjure-java-core/src/integrationInput/java/com/palantir/product/ErrorServiceBlocking.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.
Let's add some end-to-end tests using a conjure-undertow service producing failures, and a dialogue client handling them to make sure the pieces fit together in practice!
conjure-java-core/src/integrationInput/java/com/palantir/product/ErrorServiceBlocking.java
Outdated
Show resolved
Hide resolved
3b8f4fd
to
602b331
Compare
584a5e6
to
619e6dc
Compare
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.
approving for a release candidate!
Invalidated by push of 5e9a237
3e4c749
to
2797feb
Compare
[skip ci]
d1e994c
to
0840c97
Compare
Released 8.44.0 |
Before this PR
In #2401, we added the ability to associate errors with endpoints so servers could throw checked exceptions (extensions of
CheckedServiceException
). Clients still catchRemoteException
s.After this PR
Dialogue client interface methods for endpoints which have associated errors will return result types - implemented as sealed interfaces permitting a successful result member, and a member for each error. This enforces that clients handle all errors an endpoint can throw at compile time.
Examples of generated code are given here
This feature should be used with Java 21 to make use of the exhaustive pattern matching switch feature.
==COMMIT_MSG==
Generate error result types in Dialogue interfaces for endpoints with associated errors
==COMMIT_MSG==
Possible downsides?
If not rolled out judiciously, this feature may result in compile breaks. Concretely, if a service enables this feature and publishes JARs containing the generated Dialogue clients, consumers of the JARs will be forced to resolve the compile breaks they encounter when using the Dialogue clients.