Skip to content
Snippets Groups Projects
Commit eb4d9e9f authored by dgelessus's avatar dgelessus
Browse files

Report CLI startup exceptions in one place where they are caught

The previous code expected all exceptions to be reported before they are
thrown, but not everything did that.
parent fde33999
No related branches found
No related tags found
No related merge requests found
......@@ -102,10 +102,7 @@ public final class CliStarter {
try {
prologProcess = pb.start();
} catch (IOException e) {
final String message = "Problem while starting up ProB CLI. Tried to execute:"
+ executable;
Logger.notifyUser(message, e);
throw new CliException(message, e, true);
throw new CliException("Problem while starting up ProB CLI. Tried to execute:" + executable, e, false);
}
Assert.isNotNull(prologProcess);
......@@ -144,10 +141,7 @@ public final class CliStarter {
} else if (os.equals(Platform.OS_LINUX)) {
subdir = "linux64";
} else {
final CliException cliException = new CliException(
"ProB does not support the plattform: " + os);
cliException.notifyUserOnce();
throw cliException;
throw new CliException("ProB does not support the plattform: " + os);
}
return new OsSpecificInfo(subdir, "probcli.sh",
......@@ -187,9 +181,7 @@ public final class CliStarter {
|| line.contains("starting command loop"); // printed in prob_socketserver.pl
}
} catch (IOException e) {
final String message = "Problem while starting ProB. Cannot read from input stream.";
Logger.notifyUser(message, e);
throw new CliException(message, e, true);
throw new CliException("Problem while starting ProB. Cannot read from input stream.", e, true);
}
for (CliPattern<?> p : patterns) {
p.notFound();
......@@ -228,11 +220,9 @@ public final class CliStarter {
return new File(resolvedUri);
} catch (URISyntaxException e) {
throw new CliException("Unable to construct file '"
+ entry.getPath() + "'");
throw new CliException("Unable to construct file '" + entry.getPath() + "'", e, false);
} catch (IOException e2) {
throw new CliException("Input/output error when trying t find '"
+ fileURL + "'");
throw new CliException("Input/output error when trying t find '" + fileURL + "'", e2, false);
}
}
......
......@@ -39,14 +39,7 @@ public class PortPattern extends CliPattern<Integer> {
@Override
public void notFound() throws CliException {
// final String message = "Could not determine port of ProB server";
// Logger.notifyUser(message);
// throw new CliException(message);
CliException cliException = new CliException(
"Could not determine port of ProB server");
cliException.notifyUserOnce();
throw cliException;
throw new CliException("Could not determine port of ProB server");
}
}
......@@ -98,8 +98,7 @@ public class AnimatorImpl {
try {
connector.startup(file);
} catch (CliException e) {
// The user has been notified by the underlying implementation, so
// we only invalidate the connector
e.notifyUserOnce();
connector = null;
}
}
......
......@@ -62,8 +62,7 @@ public class ServerConnection implements IServerConnection {
outputStream = null;
}
}
ProblemHandler.handleCliException(
"Opening connection to ProB server failed", e);
throw new CliException("Opening connection to ProB server failed", e, false);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment