Skip to content

Fix return types of async APIs#191

Merged
sophokles73 merged 1 commit intoeclipse-uprotocol:mainfrom
etas-contrib:fix_return_types_of_async_apis
Sep 5, 2025
Merged

Fix return types of async APIs#191
sophokles73 merged 1 commit intoeclipse-uprotocol:mainfrom
etas-contrib:fix_return_types_of_async_apis

Conversation

@sophokles73
Copy link
Contributor

The operations of the L1, L2 and L3 APIs have all been returning CompletableFuture
and had always been succeeded with a UStatus. Client code then had to check if the UCode was
OK or not. This has been changed so that the operations now return CompletableFuture
and complete normally if the operation was successful. If the operation failed, the future
completes exceptionally with a UStatusException containing the UStatus with the error code.

This is much more aligned with the way async operations are usually handled in Java
and makes client code much cleaner.

The operations of the L1, L2 and L3 APIs have all been returning CompletableFuture<UStatus>
and had always been succeeded with a UStatus. Client code then had to check if the UCode was
OK or not. This has been changed so that the operations now return CompletableFuture<Void>
and complete normally if the operation was successful. If the operation failed, the future
completes exceptionally with a UStatusException containing the UStatus with the error code.

This is much more aligned with the way async operations are usually handled in Java
and makes client code much cleaner.
@sophokles73 sophokles73 added the enhancement New feature or request label Sep 4, 2025
@github-actions
Copy link

github-actions bot commented Sep 4, 2025

Code coverage report is ready! 📈

Copy link

@PLeVasseur PLeVasseur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Kai. I haven't read the details, but conceptually cleaner makes sense to me.

@sophokles73 sophokles73 merged commit 3d63f25 into eclipse-uprotocol:main Sep 5, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants