Renamed PyExternalProcessException to PyExecutionException

This commit is contained in:
Andrey Vlasovskikh
2014-09-23 17:06:13 +04:00
parent 00cdaa2b96
commit c669ff8ce8
4 changed files with 19 additions and 19 deletions
@@ -27,7 +27,7 @@ import java.util.regex.Pattern;
/**
* @author vlan
*/
public class PyExternalProcessException extends ExecutionException {
public class PyExecutionException extends ExecutionException {
private static final Pattern WITH_CR_DELIMITER_PATTERN = Pattern.compile("(?<=\r|\n|\r\n)");
@NotNull private String myName;
@@ -35,12 +35,12 @@ public class PyExternalProcessException extends ExecutionException {
@NotNull private String myMessage;
@NotNull private final List<? extends PyExecutionFix> myFixes;
public PyExternalProcessException(@NotNull String name, @NotNull List<String> args, @NotNull String message) {
public PyExecutionException(@NotNull String name, @NotNull List<String> args, @NotNull String message) {
this(name, args, message, Collections.<PyExecutionFix>emptyList());
}
public PyExternalProcessException(@NotNull String name, @NotNull List<String> args, @NotNull String message,
@NotNull List<? extends PyExecutionFix> fixes) {
public PyExecutionException(@NotNull String name, @NotNull List<String> args, @NotNull String message,
@NotNull List<? extends PyExecutionFix> fixes) {
super(String.format("External process error '%s %s':\n%s", name, StringUtil.join(args, " "), message));
myName = name;
myArgs = args;
@@ -424,11 +424,11 @@ public class PyPackageManagerImpl extends PyPackageManager {
final ProcessOutput output = getPythonProcessOutput(path, args, askForSudo, showProgress, workingDir);
final int exitCode = output.getExitCode();
if (output.isTimeout()) {
throw new PyExternalProcessException(path, args, "Timed out");
throw new PyExecutionException(path, args, "Timed out");
}
else if (exitCode != 0) {
final String message = output.getStderr() + "\n" + output.getStdout();
throw new PyExternalProcessException(path, args, message);
throw new PyExecutionException(path, args, message);
}
return output.getStdout();
}
@@ -499,7 +499,7 @@ public class PyPackageManagerImpl extends PyPackageManager {
if (StringUtil.isEmptyOrSpaces(message)) {
message = "Failed to perform action. Permission denied.";
}
throw new PyExternalProcessException(helperPath, args, message);
throw new PyExecutionException(helperPath, args, message);
}
return result;
}
@@ -507,10 +507,10 @@ public class PyPackageManagerImpl extends PyPackageManager {
throw e;
}
catch (ExecutionException e) {
throw new PyExternalProcessException(helperPath, args, e.getMessage());
throw new PyExecutionException(helperPath, args, e.getMessage());
}
catch (IOException e) {
throw new PyExternalProcessException(helperPath, args, e.getMessage());
throw new PyExecutionException(helperPath, args, e.getMessage());
}
}
@@ -521,7 +521,7 @@ public class PyPackageManagerImpl extends PyPackageManager {
for (String line : lines) {
final List<String> fields = StringUtil.split(line, "\t");
if (fields.size() < 3) {
throw new PyExternalProcessException(PACKAGING_TOOL, Collections.<String>emptyList(), "Invalid output format");
throw new PyExecutionException(PACKAGING_TOOL, Collections.<String>emptyList(), "Invalid output format");
}
final String name = fields.get(0);
final String version = fields.get(1);
@@ -117,12 +117,12 @@ public class PyRemotePackageManagerImpl extends PyPackageManagerImpl {
}
}
});
throw new PyExternalProcessException(helperPath, args, "Vagrant instance is down. <a href=\"" +
throw new PyExecutionException(helperPath, args, "Vagrant instance is down. <a href=\"" +
LAUNCH_VAGRANT +
"\">Launch vagrant</a>", fixes);
}
else {
throw new PyExternalProcessException(helperPath, args, e.getMessage());
throw new PyExecutionException(helperPath, args, e.getMessage());
}
}
final PythonRemoteInterpreterManager manager = PythonRemoteInterpreterManager.getInstance();
@@ -154,16 +154,16 @@ public class PyRemotePackageManagerImpl extends PyPackageManagerImpl {
return processOutput;
}
catch (ExecutionException e) {
throw new PyExternalProcessException(helperPath, args, "Error running SDK: " + e.getMessage());
throw new PyExecutionException(helperPath, args, "Error running SDK: " + e.getMessage());
}
}
else {
throw new PyExternalProcessException(helperPath, args,
throw new PyExecutionException(helperPath, args,
PythonRemoteInterpreterManager.WEB_DEPLOYMENT_PLUGIN_IS_DISABLED);
}
}
else {
throw new PyExternalProcessException(helperPath, args, "Invalid remote SDK");
throw new PyExecutionException(helperPath, args, "Invalid remote SDK");
}
}
@@ -97,18 +97,18 @@ public class PyInstalledPackagesPanel extends InstalledPackagesPanel {
application.executeOnPooledThread(new Runnable() {
@Override
public void run() {
PyExternalProcessException exception = null;
PyExecutionException exception = null;
try {
myHasManagement = PyPackageManager.getInstance(selectedSdk).hasManagement(false);
if (!myHasManagement) {
throw new PyExternalProcessException("pip", Collections.<String>emptyList(), "Python packaging tools not found",
throw new PyExecutionException("pip", Collections.<String>emptyList(), "Python packaging tools not found",
ImmutableList.of(new PyInstallPackageManagementFix()));
}
}
catch (PyExternalProcessException e) {
catch (PyExecutionException e) {
exception = e;
}
final PyExternalProcessException problem = exception;
final PyExecutionException problem = exception;
application.invokeLater(new Runnable() {
@Override
public void run() {