question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Automatic handling of CompletionException

See original GitHub issue

Currently 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:closed
  • Created 5 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
kmehrunescommented, Aug 2, 2018

I think that pretty much covers it. Thanks.

0reactions
tipsycommented, Aug 2, 2018

Added in https://github.com/tipsy/javalin/commit/fe1b1016f7da1ff112d953cd0b6eb8f5cf71a35f @kmehrunes, please have a look and see if it’ll cover your use case.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found