use of org.eclipse.che.plugin.nodejsdbg.server.exception.NodeJsDebuggerException in project che by eclipse.
the class NodeJsDebugProcess method initializeNodeJsDebugProcess.
private Process initializeNodeJsDebugProcess(String[] options) throws NodeJsDebuggerException {
List<String> commands = new ArrayList<>(1 + options.length);
commands.add(NODEJS_COMMAND);
commands.addAll(Arrays.asList(options));
ProcessBuilder processBuilder = new ProcessBuilder(commands);
try {
return processBuilder.start();
} catch (IOException e) {
throw new NodeJsDebuggerException("NodeJs process initialization failed.", e);
}
}
use of org.eclipse.che.plugin.nodejsdbg.server.exception.NodeJsDebuggerException in project che by eclipse.
the class NodeJsDebugger method setValue.
@Override
public void setValue(Variable variable) throws DebuggerException {
try {
List<String> path = variable.getVariablePath().getPath();
if (path.isEmpty()) {
throw new DebuggerException("Variable path is empty");
}
library.setVar(path.get(0), variable.getValue());
} catch (NodeJsDebuggerTerminatedException e) {
disconnect();
throw e;
} catch (NodeJsDebuggerException e) {
throw new DebuggerException("Can't set value for " + variable.getName() + ". " + e.getMessage(), e);
}
}
use of org.eclipse.che.plugin.nodejsdbg.server.exception.NodeJsDebuggerException in project che by eclipse.
the class NodeJsDebugger method addBreakpoint.
@Override
public void addBreakpoint(Breakpoint breakpoint) throws DebuggerException {
try {
Location location = breakpoint.getLocation();
library.setBreakpoint(location.getTarget(), location.getLineNumber());
debuggerCallback.onEvent(new BreakpointActivatedEventImpl(breakpoint));
} catch (NodeJsDebuggerTerminatedException e) {
disconnect();
throw e;
} catch (NodeJsDebuggerException e) {
throw new DebuggerException("Can't add breakpoint: " + breakpoint + ". " + e.getMessage(), e);
}
}
use of org.eclipse.che.plugin.nodejsdbg.server.exception.NodeJsDebuggerException in project che by eclipse.
the class NodeJsDebugProcess method send.
/**
* Synchronizes sending commands.
*/
public synchronized void send(String command) throws NodeJsDebuggerException {
LOG.debug("Execute: {}", command);
if (!process.isAlive()) {
throw new NodeJsDebuggerTerminatedException("NodeJs process has been terminated.");
}
try {
processWriter.write(command);
processWriter.newLine();
processWriter.flush();
} catch (IOException e) {
throw new NodeJsDebuggerException(e.getMessage(), e);
}
}
use of org.eclipse.che.plugin.nodejsdbg.server.exception.NodeJsDebuggerException in project che by eclipse.
the class NodeJsDebugger method start.
@Override
public void start(StartAction action) throws DebuggerException {
try {
for (Breakpoint breakpoint : action.getBreakpoints()) {
Location location = breakpoint.getLocation();
library.setBreakpoint(location.getTarget(), location.getLineNumber());
debuggerCallback.onEvent(new BreakpointActivatedEventImpl(breakpoint));
}
library.backtrace();
} catch (NodeJsDebuggerTerminatedException e) {
disconnect();
throw e;
} catch (NodeJsDebuggerException e) {
throw new DebuggerException("Start error. " + e.getMessage(), e);
}
}
Aggregations