Build tw: init external system exception cause for gradle to distinguish internal...
authorVladislav.Soroka <Vladislav.Soroka@jetbrains.com>
Tue, 30 Apr 2019 13:02:25 +0000 (16:02 +0300)
committerintellij-monorepo-bot <intellij-monorepo-bot-no-reply@jetbrains.com>
Thu, 2 May 2019 23:37:24 +0000 (02:37 +0300)
GitOrigin-RevId: 6a51870279d9c5f7bdf5f0afb3225ac38671524e

platform/external-system-rt/src/com/intellij/openapi/externalSystem/model/ExternalSystemException.java
plugins/gradle/src/org/jetbrains/plugins/gradle/service/execution/GradleExecutionHelper.java
plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/DistributionFactoryExt.java
plugins/gradle/src/org/jetbrains/plugins/gradle/service/task/GradleTaskManager.java

index b0215bcee9a89e6aa7ebaee317cc326319071215..d379696cfa5716fbf0b33262ed478a38771e3c84 100644 (file)
@@ -42,7 +42,7 @@ public class ExternalSystemException extends RuntimeException {
     this(message, null, quickFixes);
   }
 
-  public ExternalSystemException(@Nullable String message, @Nullable Throwable cause, @NotNull String... quickFixes) {
+public ExternalSystemException(@Nullable String message, @Nullable Throwable cause, @NotNull String... quickFixes) {
     super(extractMessage(message, cause));
     myQuickFixes = mergeArrays(cause instanceof ExternalSystemException
                                ? ((ExternalSystemException)cause).getQuickFixes()
index c029492e6ae1fcef696631c1af19e8a79fe21e6f..e78897a762ecaf461a5020e55ad4d9e512349d91 100644 (file)
@@ -244,7 +244,9 @@ public class GradleExecutionHelper {
     catch (Throwable e) {
       LOG.debug("Gradle execution error", e);
       Throwable rootCause = ExceptionUtil.getRootCause(e);
-      throw new ExternalSystemException(ExceptionUtil.getMessage(rootCause), e);
+      ExternalSystemException externalSystemException = new ExternalSystemException(ExceptionUtil.getMessage(rootCause), e);
+      externalSystemException.initCause(e);
+      throw externalSystemException;
     }
     finally {
       try {
@@ -316,7 +318,9 @@ public class GradleExecutionHelper {
     catch (Throwable e) {
       LOG.warn("Can't update wrapper", e);
       Throwable rootCause = ExceptionUtil.getRootCause(e);
-      throw new ExternalSystemException(ExceptionUtil.getMessage(rootCause));
+      ExternalSystemException externalSystemException = new ExternalSystemException(ExceptionUtil.getMessage(rootCause));
+      externalSystemException.initCause(e);
+      throw externalSystemException;
     }
     finally {
       settings.setRemoteProcessIdleTtlInMs(ttlInMs);
index cff2d4e5628e46801b678242f310380c63efbf85..8e74b6f2ab1514fab24bda21a111a004752e2c2d 100644 (file)
@@ -63,7 +63,9 @@ public class DistributionFactoryExt extends DistributionFactory {
           setDistributionField(connector, distribution);
         }
         catch (Exception e) {
-          throw new ExternalSystemException(e);
+          ExternalSystemException externalSystemException = new ExternalSystemException(e);
+          externalSystemException.initCause(e);
+          throw externalSystemException;
         }
       }
     }
index 738e28c8fe99dc55ab86683563b405fc5bf9a7cd..4072c263702ee0aceb516c3de5056f22c2a1a140 100644 (file)
@@ -194,7 +194,9 @@ public class GradleTaskManager extends BaseExternalSystemTaskManager<GradleExecu
         effectiveSettings.withArguments(GradleConstants.INIT_SCRIPT_CMD_OPTION, tempFile.getAbsolutePath());
       }
       catch (IOException e) {
-        throw new ExternalSystemException(e);
+        ExternalSystemException systemException = new ExternalSystemException(e);
+        systemException.initCause(e);
+        throw systemException;
       }
     }
 
@@ -212,7 +214,9 @@ public class GradleTaskManager extends BaseExternalSystemTaskManager<GradleExecu
         effectiveSettings.withArguments(GradleConstants.INIT_SCRIPT_CMD_OPTION, tempFile.getAbsolutePath());
       }
       catch (IOException e) {
-        throw new ExternalSystemException(e);
+        ExternalSystemException externalSystemException = new ExternalSystemException(e);
+        externalSystemException.initCause(e);
+        throw externalSystemException;
       }
     }
   }