Propagate CF hints errors to framework
This commit is contained in:
@@ -49,22 +49,27 @@ public abstract class AbstractCFHintsProvider implements Callable<Collection<YVa
|
||||
Collection<YValueHint> 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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user