From 1e740285390ae3c2791daa807c4eea5b81d69993 Mon Sep 17 00:00:00 2001 From: nsingh Date: Thu, 19 Jan 2017 16:41:36 -0800 Subject: [PATCH] Propagate CF hints errors to framework --- .../yaml/AbstractCFHintsProvider.java | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/vscode-extensions/vscode-manifest-yaml/src/main/java/org/springframework/ide/vscode/manifest/yaml/AbstractCFHintsProvider.java b/vscode-extensions/vscode-manifest-yaml/src/main/java/org/springframework/ide/vscode/manifest/yaml/AbstractCFHintsProvider.java index 58734d6e0..9c58f498e 100644 --- a/vscode-extensions/vscode-manifest-yaml/src/main/java/org/springframework/ide/vscode/manifest/yaml/AbstractCFHintsProvider.java +++ b/vscode-extensions/vscode-manifest-yaml/src/main/java/org/springframework/ide/vscode/manifest/yaml/AbstractCFHintsProvider.java @@ -49,22 +49,27 @@ public abstract class AbstractCFHintsProvider implements Callable resolvedHints = getHints(targets); hints.addAll(resolvedHints); } catch (Throwable e) { - // Don't log the no target found error. Just inform the user - if (ExceptionUtil.getThrowable(e, NoTargetsException.class) != null) { - hints.add(new BasicYValueHint(EMPTY_VALUE, e.getMessage())); - } else { - + // Convert any non "no-target" errors to something useful. The + // "no-target" errors + // are generated by the target provider so they should be propagated + // as is without further + // transformation + if (ExceptionUtil.getThrowable(e, NoTargetsException.class) == null) { // Log any other error logger.log(Level.SEVERE, e.getMessage(), e); if (ExceptionUtil.getThrowable(e, IOException.class) != null) { - hints.add(new BasicYValueHint(EMPTY_VALUE, - "Connection failure to Cloud Foundry. Please check the log for more details.")); + throw ExceptionUtil.exception( + "Connection failure to Cloud Foundry. Please check the log for more details.", e); + } else { - hints.add(new BasicYValueHint(EMPTY_VALUE, - "Failed to fetch values from Cloud Foundry. Please check the log for more details.")); + throw ExceptionUtil.exception( + "Failed to fetch values from Cloud Foundry. Please check the log for more details.", e); } } + else { + throw e; + } } return hints; }