Java RuntimeException Create toRuntimeException(Exception e)

Here you can find the source of toRuntimeException(Exception e)

Description

Do never catch Throwables!

License

Open Source License

Parameter

Parameter Description
e a parameter

Declaration

public static RuntimeException toRuntimeException(Exception e) 

Method Source Code

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

public class Main {
    /**//from   w w  w .  j a v  a2s .  co  m
     * Do never catch Throwables!
     * 
     * @param e
     * @return
     */
    public static RuntimeException toRuntimeException(Exception e) {

        return e instanceof RuntimeException ? (RuntimeException) e : new RuntimeException(e);
    }
}

Related

  1. toRuntimeException(Exception e)
  2. toRuntimeException(Exception ex)
  3. toRuntimeException(final Throwable e)
  4. toRuntimeException(Throwable e)
  5. toRuntimeException(Throwable t)