Automatic handling of CompletionException
See original GitHub issueCurrently in order to handle a CompletionException one needs to do something like this:
app.exception(CompletionException.class, (ex, context) -> {
HaltException cause = (HaltException) ex.getCause();
context.status(cause.getStatusCode())
.result(cause.getBody());
});
Which basically does what Javalin automatically does for HaltException. In which case it should be the case that the framework automatically handles CompletionExceptions when the underlying exception is a HaltException. Otherwise, it’s passed over to another exception handler.
Although HaltExeptions were removed the same should apply to their replacement.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Throwing exception from CompletableFuture - Stack Overflow
All exceptions thrown inside the asynchronous processing of the Supplier will get wrapped into a CompletionException when calling join ...
Read more >Different ways of Handling Exceptions in CompletableFutures
The exception passed to the exceptionally function is Completion Exception which wraps the actual exception as its root cause. future = future.
Read more >CompletionException and JAX-RS handling - RManniBucau
One example is when you write a kind of proxy for a microservice or just connect multiple microservices together using JAX-RS client API....
Read more >Exception in failed CompletionStage is always ... - GitHub
ExceptionHandler exceptionHandler = ExceptionHandler.newBuilder() .match(CompletionException.class, e -> { if (e.getCause() instanceof ...
Read more >java.nio.file.InvalidPathException: Trailing char < > at index N ...
Hi, When starting sonar lint, I get this error VSCode SonarLint output [Info - 10:25:42.475] Started security hotspot handler on port 64120 ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think that pretty much covers it. Thanks.
Added in https://github.com/tipsy/javalin/commit/fe1b1016f7da1ff112d953cd0b6eb8f5cf71a35f @kmehrunes, please have a look and see if it’ll cover your use case.