org.neo4j.helpers
Class Exceptions
java.lang.Object
org.neo4j.helpers.Exceptions
public class Exceptions
- extends Object
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
withCause
public static <T extends Throwable> T withCause(T exception,
Throwable cause)
launderedException
public static RuntimeException launderedException(Throwable exception)
launderedException
public static RuntimeException launderedException(String messageForUnexpected,
Throwable exception)
launderedException
public static <T extends Throwable> T launderedException(Class<T> type,
Throwable exception)
launderedException
public static <T extends Throwable> T launderedException(Class<T> type,
String messageForUnexpected,
Throwable exception)
peel
public static Throwable peel(Throwable exception,
Predicate<Throwable> toPeel)
- Peels off layers of causes. For example:
MyFarOuterException
cause: MyOuterException
cause: MyInnerException
cause: MyException
and a toPeel predicate returning true for MyFarOuterException and MyOuterException
will return MyInnerException. If the predicate peels all exceptions null is returned.
- Parameters:
exception
- the outer exception to peel to get to an inner cause.toPeel
- Predicate
for deciding what to peel. true
means
to peel (i.e. remove), whereas the first false
means stop and return.
- Returns:
- the inner cause of an exception, dictated by the predicate.
exceptionsOfType
public static Predicate<Throwable> exceptionsOfType(Class<? extends Throwable>... types)
Copyright © 2002-2013 The Neo4j Graph Database Project. All Rights Reserved.