Java Exception to String exceptionWithCause(T exception, Throwable cause)

Here you can find the source of exceptionWithCause(T exception, Throwable cause)

Description

Throw the exception with the specified cause.

License

Open Source License

Declaration

static <T extends Throwable> T exceptionWithCause(T exception,
        Throwable cause) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**//from  ww  w. j a  va  2 s  .  com
     * Throw the exception with the specified cause.
     *
     * <p>Needed instead of constructor version to be compatible with JDK 1.5 which is required
     * until Andriod libraries can update to JDK 1.6
     */
    static <T extends Throwable> T exceptionWithCause(T exception,
            Throwable cause) {
        exception.initCause(cause);
        return exception;
    }
}

Related

  1. exceptionToString(Throwable e)
  2. exceptionToString(Throwable e)
  3. exceptionToString(Throwable ex)
  4. exceptionToString(Throwable exception)
  5. exceptionTypeAndMsg(Exception e)
  6. getErrorMessage(Exception ex)
  7. getErrorMessage(Exception ex)
  8. getErrorMessage(Process process)
  9. getException(Exception e)