don't show type when collapsing UserFacingExceptions
Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/02d86fce Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/02d86fce Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/02d86fce Branch: refs/heads/master Commit: 02d86fce841a83e5e809dbe719e27db5be4ec23a Parents: 40959c6 Author: Alex Heneveld <[email protected]> Authored: Fri Sep 11 10:19:05 2015 +0100 Committer: Alex Heneveld <[email protected]> Committed: Fri Sep 11 10:54:40 2015 +0100 ---------------------------------------------------------------------- .../java/org/apache/brooklyn/util/exceptions/Exceptions.java | 5 +++-- .../apache/brooklyn/util/exceptions/UserFacingException.java | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/02d86fce/utils/common/src/main/java/org/apache/brooklyn/util/exceptions/Exceptions.java ---------------------------------------------------------------------- diff --git a/utils/common/src/main/java/org/apache/brooklyn/util/exceptions/Exceptions.java b/utils/common/src/main/java/org/apache/brooklyn/util/exceptions/Exceptions.java index eac137d..c185890 100644 --- a/utils/common/src/main/java/org/apache/brooklyn/util/exceptions/Exceptions.java +++ b/utils/common/src/main/java/org/apache/brooklyn/util/exceptions/Exceptions.java @@ -64,12 +64,13 @@ public class Exceptions { private static List<Class<? extends Throwable>> BORING_PREFIX_THROWABLE_EXACT_TYPES = ImmutableList.<Class<? extends Throwable>>of( IllegalStateException.class, RuntimeException.class, CompoundRuntimeException.class); - /** Returns whether this is throwable either known to be boring or to have an unuseful prefix; - * null is *not* boring. */ + /** Returns whether this is throwable either known to be boring or to have an unhelpful type name (prefix) + * which should be suppressed. null is accepted but treated as not boring. */ public static boolean isPrefixBoring(Throwable t) { if (t==null) return false; if (isBoring(t)) return true; + if (t instanceof UserFacingException) return true; for (Class<? extends Throwable> type: BORING_PREFIX_THROWABLE_EXACT_TYPES) if (t.getClass().equals(type)) return true; return false; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/02d86fce/utils/common/src/main/java/org/apache/brooklyn/util/exceptions/UserFacingException.java ---------------------------------------------------------------------- diff --git a/utils/common/src/main/java/org/apache/brooklyn/util/exceptions/UserFacingException.java b/utils/common/src/main/java/org/apache/brooklyn/util/exceptions/UserFacingException.java index 34673e6..1830ac8 100644 --- a/utils/common/src/main/java/org/apache/brooklyn/util/exceptions/UserFacingException.java +++ b/utils/common/src/main/java/org/apache/brooklyn/util/exceptions/UserFacingException.java @@ -19,7 +19,7 @@ package org.apache.brooklyn.util.exceptions; /** marker interface, to show that an exception is suitable for pretty-printing to an end-user, - * without including a stack trace */ + * without the prefix (type) including a stack trace */ public class UserFacingException extends RuntimeException { private static final long serialVersionUID = 2216885527195571323L;
