Skip to content

Commit 3d1239d

Browse files
committed
Show a notification when the Node.js process fails to start (#100)
1 parent f98a82e commit 3d1239d

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/main/com/intellij/lang/jsgraphql/languageservice/JSGraphQLNodeLanguageServiceInstance.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@
99

1010
import com.intellij.execution.ExecutionException;
1111
import com.intellij.execution.configurations.GeneralCommandLine;
12-
import com.intellij.execution.process.OSProcessHandler;
13-
import com.intellij.execution.process.ProcessAdapter;
14-
import com.intellij.execution.process.ProcessEvent;
15-
import com.intellij.execution.process.ProcessOutputTypes;
12+
import com.intellij.execution.process.*;
1613
import com.intellij.ide.plugins.IdeaPluginDescriptor;
1714
import com.intellij.ide.plugins.PluginManager;
1815
import com.intellij.javascript.nodejs.interpreter.NodeJsInterpreter;
1916
import com.intellij.javascript.nodejs.interpreter.NodeJsInterpreterManager;
2017
import com.intellij.javascript.nodejs.interpreter.local.NodeJsLocalInterpreter;
2118
import com.intellij.lang.jsgraphql.JSGraphQLDebugUtil;
2219
import com.intellij.lang.jsgraphql.ide.project.JSGraphQLLanguageUIProjectService;
20+
import com.intellij.notification.Notification;
21+
import com.intellij.notification.NotificationType;
22+
import com.intellij.notification.Notifications;
2323
import com.intellij.openapi.application.Application;
2424
import com.intellij.openapi.application.ApplicationManager;
2525
import com.intellij.openapi.diagnostic.Logger;
@@ -146,7 +146,11 @@ private void createProcessHandler() {
146146

147147

148148
} catch (IOException | ExecutionException e) {
149-
log.error("Error running JS GraphQL Language Service using Node.js", e);
149+
if (e instanceof ProcessNotCreatedException) {
150+
Notifications.Bus.notify(new Notification("GraphQL", "Unable to start JS GraphQL Language Service", "Node.js was not started: " + e.getMessage(), NotificationType.ERROR));
151+
} else {
152+
log.error("Error running JS GraphQL Language Service using Node.js", e);
153+
}
150154
}
151155
}
152156

0 commit comments

Comments
 (0)