Returns a {@link RuntimeException} for the given exception.

@param exc An exception.
@return A {@link RuntimeException}
967575
public static RuntimeException getRuntimeException(final Throwable exc) {
        Throwable e = exc;
        while (e.getCause() instanceof RuntimeException) {
            e = e.getCause();
        }
        if (e instanceof RuntimeException) {
            return (RuntimeException) e;
        } else {
            return new RuntimeException(exc);
        }
    }
60392
def init_soap_exception(self, exc):
        
        if not isinstance(exc, urllib2.HTTPError):
            return SoapException(unicode(exc), exc)

        if isinstance(exc, urllib2.HTTPError):
            try:
                data = exc.read()
                self.log.debug(data)

                t = SOAPpy.Parser.parseSOAP(data)
                message = '%s:%s' % (t.Fault.faultcode, t.Fault.faultstring)
                e = SoapException(message, exc)
                e.code = t.Fault.detail.Error.Code
                e.trace = t.Fault.detail.Error.Trace
                return e
            except:
                return SoapException(unicode(exc), exc)

        return SoapException(exc.reason, exc)
977800
@SuppressWarnings("deprecation")
    protected Throwable getNestedException(Throwable t) {
        Throwable root = t;
        for (;;) {
            if (root instanceof RemoteException) {
                RemoteException re = (RemoteException) root;
                if (re.detail == null)
                    break;
                root = re.detail;
            } else if (root instanceof NamingException) {
                NamingException ne = (NamingException) root;
                if (ne.getRootCause() == null)
                    break;
                root = ne.getRootCause();
            } else if (root instanceof com.ibm.ws.exception.WsNestedException) { //d121522
                com.ibm.ws.exception.WsNestedException ne = (com.ibm.ws.exception.WsNestedException) root;
                if (ne.getCause() == null)
                    break;
                root = ne.getCause();
            } else {
                break;
            }
        }
        return root;
    }
507928
public static <T, E extends RuntimeException> ExceptionSupplier<T, E> throwA(E exception) {
        return new ExceptionSupplier<>(exception);
    }
1219886
public <T1 extends Throwable, T2 extends Throwable> 
                RuntimeException throwIf(Class<T1> t1, Class<T2> t2) 
                throws T1, T2 {
        return throwIf(t1, t2, NULL_EX, NULL_EX);
    }
1340583
public static RuntimeException propagate(Throwable throwable) {
    final Throwable t = Preconditions.checkNotNull(throwable, "throwable");
    if (t instanceof Error) {
      throw (Error) t;
    }
    if (t instanceof RuntimeException) {
      throw (RuntimeException) t;
    }

    throw new RuntimeException(t);
  }
1224969
public static RuntimeException handle(Throwable e) {
        if (e instanceof CRestException) {
            return handle((CRestException) e);
        }else if (e instanceof RequestException) {
            return handle((RequestException) e);
        } else if (e instanceof IllegalArgumentException) {
            return handle((IllegalArgumentException) e);
        } else if (e instanceof IllegalStateException) {
            return handle((IllegalStateException) e);
        } else if (e instanceof InvocationTargetException) {
            return handle((InvocationTargetException) e);
        } else {
            return new CRestException(e.getMessage(), e);
        }
    }
1117377
@SuppressWarnings("WeakerAccess")
  public static RuntimeException constructRuntimeExceptionWithoutStackTrace(ClassLoaderLeakPreventor preventor,
                                                                        String message, Throwable cause) {
    try {
      final Constructor<RuntimeException> constructor = 
          RuntimeException.class.getDeclaredConstructor(String.class, Throwable.class, Boolean.TYPE, Boolean.TYPE);
      constructor.setAccessible(true);
      return constructor.newInstance(message, cause, true, false /* disable stack trace */);
    }
    catch (Throwable e) { // InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException
      preventor.warn("Unable to construct RuntimeException without stack trace. The likely reason is that you are using Java <= 1.6. " +
          "No worries, except there might be some leaks you're not protected from (https://github.com/mjiderhamn/classloader-leak-prevention/issues/36 , " +
          "https://github.com/mjiderhamn/classloader-leak-prevention/issues/69). " + 
          "If you are already on Java 1.7+, please report issue to developer of this library!");
      preventor.warn(e);
      return null;
    }
  }
1246477
@SuppressWarnings("unchecked")
    private E wrappedException(final Exception exp) {
        E wrapped = new UncheckedFunc<>(this.func).apply(exp);
        final int level = new InheritanceLevel(
            exp.getClass(), wrapped.getClass()
        ).value();
        final String message = wrapped.getMessage()
            .replaceFirst(
                new UncheckedText(
                    new FormattedText(
                        "%s: ",
                        exp.getClass().getName()
                    )
                ).asString(),
                ""
            );
        if (level >= 0 && message.equals(exp.getMessage())) {
            wrapped = (E) exp;
        }
        return wrapped;
    }
1265801
public static RuntimeException launderCacheListenerException(CacheListenerException e) {
      Throwable cause = e.getCause();

      if (cause instanceof CacheEntryListenerException)
         return (CacheEntryListenerException) cause;

      if (cause instanceof Exception)
         return new CacheEntryListenerException(cause);

      if (cause instanceof Error)
         throw (Error) cause;

      return e;
   }
469888
public CodeException[] collectExceptions(CodeException... exs) {
        List<CodeException> filteredEx = new ArrayList<>();
        for (CodeException ce : exs) {
            if ((ce.getCatchType() != 0) && (ce.getStartPC() < ce.getEndPC()) && (ce.getEndPC() <= ce.getHandlerPC())) {
                filteredEx.add(ce);
            }
        }
        return filteredEx.toArray(new CodeException[0]);
    }
694257
public static RuntimeException launderEntryProcessorException(Exception e) {
      if (e instanceof CacheException)
         return (CacheException) e;

      return new EntryProcessorException(e);
   }
44664
public RuntimeException traceError( RuntimeException cause ) {
        getLogger().log( Level.SEVERE, "Error during deserialization", cause );
        if ( wrapExceptions ) {
            return new JsonDeserializationException( cause );
        } else {
            return cause;
        }
    }
992607
public static RuntimeException imposterize( Throwable t )
    {
        if (t instanceof RuntimeException) return (RuntimeException) t;

        return new ExceptionImposter( t  );
    }
1187350
def logexception(self, logger=None):
        '''
        
        '''
        traceback.print_exc()
        if logger: 
            logger.exception('Unexpected runtime Error...')
        else:
            self.logger.exception('Unexpected runtime Error...')
1162746
@Override
    protected void throwExceptionForError(final int errorCode) {
        try {
            m_connection.throwException(errorCode);
        } catch (final IOException e) {
            throw new RuntimeException(e);
        }
    }
382416
public static void logRuntimeException(Logger log, String exceptionMessage,
            String method, Object... params) {
        handleException(log, newRunTimeException(exceptionMessage), method,
                params);
    }