Fixed bug where no-targets error still contains appended information

This commit is contained in:
nsingh
2017-01-24 15:46:48 -08:00
parent e35ae2e0c9
commit 69976eeac8
3 changed files with 23 additions and 12 deletions

View File

@@ -68,6 +68,17 @@ public class ExceptionUtil {
return "An error occurred: " + getSimpleError(e);
}
}
public static String getMessageNoAppendedInformation(Throwable e) {
Throwable deepestCause = ExceptionUtil.getDeepestCause(e);
String msg = deepestCause != null ? deepestCause.getMessage() : null;
if (StringUtil.hasText(msg)) {
return msg;
} else {
return "An error occurred: " + getSimpleError(e);
}
}
public static String getSimpleError(Throwable e) {
return e.getClass().getSimpleName();

View File

@@ -186,12 +186,7 @@ public class YTypeAssistContext extends AbstractYamlAssistContext {
// If value parse exception, do not append any additional information
if (e instanceof ValueParseException) {
String msg = e.getMessage();
if (StringUtil.hasText(msg)) {
return msg;
} else {
return "An error occurred: " + getSimpleError(e);
}
return ExceptionUtil.getMessageNoAppendedInformation(e);
} else {
return ExceptionUtil.getMessage(e);
}