In unit test mode, preserve stacktrace for import error messages (in one more place)

This commit is contained in:
Dmitry Jemerov
2017-03-27 19:14:15 +02:00
parent 1ea6f7ada7
commit 321c9b514b
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,6 +15,7 @@
*/
package org.jetbrains.plugins.gradle.service.project;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.externalSystem.model.ExternalSystemException;
import com.intellij.openapi.progress.ProcessCanceledException;
@@ -158,8 +159,11 @@ public class BaseProjectImportErrorHandler extends AbstractProjectImportErrorHan
}
final String errMessage;
if (rootCauseMessage == null) {
if (rootCauseMessage == null || ApplicationManager.getApplication().isUnitTestMode()) {
StringWriter writer = new StringWriter();
if (rootCauseMessage != null) {
writer.write(rootCauseMessage + "\n");
}
rootCause.printStackTrace(new PrintWriter(writer));
errMessage = writer.toString();
}