Skip to content

Commit

Permalink
Additional logging
Browse files Browse the repository at this point in the history
  • Loading branch information
sdedic committed Nov 15, 2022
1 parent 44d561a commit 91e24ce
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
import org.eclipse.lsp4j.jsonrpc.Launcher;
import org.eclipse.lsp4j.jsonrpc.MessageConsumer;
import org.eclipse.lsp4j.jsonrpc.MessageIssueException;
import org.eclipse.lsp4j.jsonrpc.RemoteEndpoint;
import org.eclipse.lsp4j.jsonrpc.messages.Either;
import org.eclipse.lsp4j.jsonrpc.messages.Message;
import org.eclipse.lsp4j.jsonrpc.messages.NotificationMessage;
Expand Down Expand Up @@ -119,6 +120,7 @@
import org.netbeans.spi.project.ActionProvider;
import org.openide.filesystems.FileObject;
import org.openide.filesystems.FileUtil;
import org.openide.util.Exceptions;
import org.openide.util.Lookup;
import org.openide.util.NbBundle;
import org.openide.util.NbPreferences;
Expand Down Expand Up @@ -180,6 +182,10 @@ private static Launcher<NbCodeLanguageClient> createLauncher(LanguageServerImpl
}
});
})
.setExceptionHandler((t) -> {
LOG.log(Level.WARNING, "Error occurred during LSP message dispatch", t);
return RemoteEndpoint.DEFAULT_EXCEPTION_HANDLER.apply(t);
})
.create();
}

Expand Down Expand Up @@ -255,6 +261,9 @@ public void consume(Message msg) throws MessageIssueException, JsonRpcException
Lookups.executeWith(ll, () -> {
try {
delegate.consume(msg);
} catch (RuntimeException | Error e) {
LOG.log(Level.WARNING, "Error occurred during message dispatch", e);
throw e;
} finally {
// cancel while the OperationContext is still active.
if (ftoCancel != null) {
Expand Down
Loading

0 comments on commit 91e24ce

Please sign in to comment.