Skip to content

Commit

Permalink
fix: runAsync may throw exception and no log for it
Browse files Browse the repository at this point in the history
Fixes redhat-developer#448

Signed-off-by: azerr <azerr@redhat.com>
  • Loading branch information
angelozerr committed Aug 12, 2024
1 parent 31e42d6 commit 70b361a
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,12 @@ public synchronized void start() throws LanguageServerException {
// To avoid having some lock problem when message is written in the stream output
// (when there are a lot of messages to write it)
// we consume the message in async mode
CompletableFuture.runAsync(() -> consumer.consume(message));
CompletableFuture.runAsync(() -> consumer.consume(message))
.exceptionally(e -> {
// Log in the LSP console the error
getLanguageServerLifecycleManager().onError(this, e);
return null;
});
} catch (Throwable e) {
// Log in the LSP console the error
getLanguageServerLifecycleManager().onError(this, e);
Expand Down Expand Up @@ -809,12 +814,14 @@ public ServerCapabilities getServerCapabilities() {

/**
* Returns the server capabilities if it is ready and null otherwise.
*
* @return the server capabilities if it is ready and null otherwise.
*/
@Nullable
public ServerCapabilities getServerCapabilitiesSync() {
return serverCapabilities;
}

/**
* @return The language ID that this wrapper is dealing with if defined in the
* language mapping for the language server
Expand Down

0 comments on commit 70b361a

Please sign in to comment.