[updater] includes a name of a failed batch part in the error message (IDEA-198858)

This commit is contained in:
Roman Shevchenko
2018-10-22 19:05:45 +02:00
parent 544ab41db8
commit 14ac7ba521
+5 -1
View File
@@ -392,10 +392,13 @@ public class Runner {
File destDir = new File(dest);
File backupDir = null;
String jarName = null;
try {
logger().info("Extracting patch files...");
ui.startProcess("Extracting patch files...");
for (int i = 0; i < patches.length; i++) {
jarName = new File(patches[i]).getName();
logger().info("Unpacking " + jarName);
ui.setProgress(100 * i / patches.length);
File patchFile = Utils.getTempFile("patch" + i);
patchFiles.add(patchFile);
@@ -406,6 +409,7 @@ public class Runner {
}
ui.checkCancelled();
}
jarName = null;
if (backup) {
backupDir = Utils.getTempFile("backup");
@@ -423,7 +427,7 @@ public class Runner {
}
catch (Throwable t) {
logger().error("prepare failed", t);
String message = "An error occurred when preparing the patch:\n" +
String message = "An error occurred when preparing the patch" + (jarName != null ? ' ' + jarName : "") + ":\n" +
t.getClass().getSimpleName() + ": " + t.getMessage() + "\n\n" +
ui.bold("No files were changed. Please retry applying the patch.") + "\n\n" +
"More details in the log: " + logPath;