Exceptions (Neo4j Community 2.1.0-M01 API)
Date: 2014-02-20

org.neo4j.helpers

## Class Exceptions

- java.lang.Object
- - org.neo4j.helpers.Exceptions

-     public class Exceptions
      extends Object

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static boolean` | `contains(Throwable cause, Class... anyOfTheseClasses)`
    `static boolean` | `contains(Throwable cause, Predicate<Throwable> toLookFor)`
    `static boolean` | `contains(Throwable cause, String containsMessage, Class... anyOfTheseClasses)`
    `static Predicate<Throwable>` | `exceptionsOfType(Class<? extends Throwable>... types)`
    `static Predicate<Throwable>` | `isAnyOfClasses(Class... anyOfTheseClasses)`
    `static <T extends Throwable> T` | `launderedException(Class<T> type, String messageForUnexpected, Throwable exception)`
    `static <T extends Throwable> T` | `launderedException(Class<T> type, Throwable exception)`
    `static RuntimeException` | `launderedException(String messageForUnexpected, Throwable exception)`
    `static RuntimeException` | `launderedException(Throwable exception)`
    `static Throwable` | `peel(Throwable exception, Predicate<Throwable> toPeel)` Peels off layers of causes.
    `static Throwable` | `rootCause(Throwable caughtException)`
    `static String` | `stringify(Thread thread, StackTraceElement[] elements)`
    `static String` | `stringify(Throwable cause)`
    `static <T extends Throwable> T` | `withCause(T exception, Throwable cause)`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### 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 delegate 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 delegate cause of an exception, dictated by the predicate.

    - #### exceptionsOfType

          public static Predicate<Throwable> exceptionsOfType(Class<? extends Throwable>... types)

    - #### rootCause

          public static Throwable rootCause(Throwable caughtException)

    - #### stringify

          public static String stringify(Throwable cause)

    - #### stringify

          public static String stringify(Thread thread,
                         StackTraceElement[] elements)

    - #### contains

          public static boolean contains(Throwable cause,
                         String containsMessage,
                         Class... anyOfTheseClasses)

    - #### contains

          public static boolean contains(Throwable cause,
                         Class... anyOfTheseClasses)

    - #### contains

          public static boolean contains(Throwable cause,
                         Predicate<Throwable> toLookFor)

    - #### isAnyOfClasses

          public static Predicate<Throwable> isAnyOfClasses(Class... anyOfTheseClasses)

Copyright © 2002–2014 The Neo4j Graph Database Project. All rights reserved.