You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by en...@apache.org on 2020/10/15 18:07:15 UTC
[netbeans] branch master updated: Propagate a launch error to the
client.
This is an automated email from the ASF dual-hosted git repository.
entl pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git
The following commit(s) were added to refs/heads/master by this push:
new a9dc33c Propagate a launch error to the client.
new 523a8d4 Merge pull request #2459 from entlicher/vscodeext_launchError
a9dc33c is described below
commit a9dc33cba25e476d63770a3adf0fc3b3797b9665
Author: Martin Entlicher <ma...@oracle.com>
AuthorDate: Thu Oct 15 18:08:02 2020 +0200
Propagate a launch error to the client.
---
.../java/lsp/server/debugging/launch/NbLaunchDelegate.java | 12 +++++++-----
.../lsp/server/debugging/launch/NbLaunchRequestHandler.java | 3 +++
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/debugging/launch/NbLaunchDelegate.java b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/debugging/launch/NbLaunchDelegate.java
index cb92008..768b02b 100644
--- a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/debugging/launch/NbLaunchDelegate.java
+++ b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/debugging/launch/NbLaunchDelegate.java
@@ -18,18 +18,18 @@
*/
package org.netbeans.modules.java.lsp.server.debugging.launch;
-import com.sun.jdi.VMDisconnectedException;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collection;
-import java.util.HashSet;
import java.util.Map;
-import java.util.concurrent.CancellationException;
import java.util.concurrent.CompletableFuture;
import java.util.function.Consumer;
+import org.eclipse.lsp4j.jsonrpc.ResponseErrorException;
+import org.eclipse.lsp4j.jsonrpc.messages.ResponseError;
+import org.eclipse.lsp4j.jsonrpc.messages.ResponseErrorCode;
+
import org.netbeans.api.annotations.common.CheckForNull;
import org.netbeans.api.debugger.DebuggerManager;
import org.netbeans.api.debugger.DebuggerManagerAdapter;
@@ -63,7 +63,9 @@ public abstract class NbLaunchDelegate {
Pair<ActionProvider, String> providerAndCommand = findTarget(toRun, debug);
CompletableFuture<Void> launchFuture = new CompletableFuture<>();
if (providerAndCommand == null) {
- launchFuture.completeExceptionally(new CancellationException("Cannot find " + (debug ? "debug" : "run") + " action!"));
+ launchFuture.completeExceptionally(new ResponseErrorException(new ResponseError(
+ ResponseErrorCode.MethodNotFound,
+ "Cannot find " + (debug ? "debug" : "run") + " action!", null)));
return launchFuture;
}
NbProcessConsole ioContext = new NbProcessConsole(consoleMessages);
diff --git a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/debugging/launch/NbLaunchRequestHandler.java b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/debugging/launch/NbLaunchRequestHandler.java
index 53ad82a..8c0c855 100644
--- a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/debugging/launch/NbLaunchRequestHandler.java
+++ b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/debugging/launch/NbLaunchRequestHandler.java
@@ -101,6 +101,9 @@ public final class NbLaunchRequestHandler {
activeLaunchHandler.nbLaunch(file, context, !noDebug, new OutputListener(context)).thenRun(() -> {
activeLaunchHandler.postLaunch(launchArguments, context);
resultFuture.complete(null);
+ }).exceptionally(e -> {
+ resultFuture.completeExceptionally(e);
+ return null;
});
return resultFuture;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists