Return true if this is a throwable class
978276
public boolean isThrowable() {
        if (isEnum() || isInterface() || isAnnotationType()) {
            return false;
        }
        for (Type t = type; t.hasTag(CLASS); t = env.types.supertype(t)) {
            if (t.tsym == env.syms.throwableType.tsym) {
                return true;
            }
        }
        return false;
    }
949491
private static AlgorithmException wrapException(Throwable throwable) {
        if(throwable == null) {
            return null;
        } else if(throwable instanceof AlgorithmException) {
            return (AlgorithmException) throwable;
        } else {
            return new AlgorithmException(throwable.getMessage(), wrapException(throwable.getCause()), wrapStackTrace(throwable));
        }
    }
946051
public static boolean containsThrowableOfType(Throwable throwable, Class<?>... throwableTypes) {
        List<Throwable> alreadyProcessedThrowables = new ArrayList<Throwable>();
        while (true) {
            if (throwable == null) {
                // end of the list of causes
                return false;
            } else if (alreadyProcessedThrowables.contains(throwable)) {
                // infinite loop in causes
                return false;
            } else {
                for (Class<?> throwableType : throwableTypes) {
                    if (throwableType.isAssignableFrom(throwable.getClass())) {
                        return true;
                    }
                }
                alreadyProcessedThrowables.add(throwable);
                throwable = throwable.getCause();
            }
        }
    }
727509
public static boolean isFromOrSuppressedThrowable(Throwable throwable, Class<? extends Throwable> exceptionClass) {
		return convertFromOrSuppressedThrowable(throwable, exceptionClass, true) != null;
	}
1262430
def _maybe_throw(self):
        
        if self._err:
            ex_cls, ex_obj, ex_bt = self._err
            self._err = None
            PyCBC.raise_helper(ex_cls, ex_obj, ex_bt)
917323
private static <E extends Throwable> E wrapIfNecessary(Throwable throwable)
			throws RetryException {
		if (throwable instanceof Error) {
			throw (Error) throwable;
		}
		else if (throwable instanceof Exception) {
			@SuppressWarnings("unchecked")
			E rethrow = (E) throwable;
			return rethrow;
		}
		else {
			throw new RetryException("Exception in retry", throwable);
		}
	}
822705
public static <T extends Throwable> Matcher<T> isThrowable(Class<?> type) {
        return IsThrowable.isThrowable(type);
    }
463185
@SuppressWarnings("unchecked")
	public static <T extends Throwable> T convertFromOrSuppressedThrowable(Throwable throwable, Class<T> exceptionClass, boolean checkCause) {
		if (throwable == null || exceptionClass == null) {
			return null;
		}
		if (exceptionClass.isAssignableFrom(throwable.getClass())) {
			return (T) throwable;
		}
		if (checkCause) {
			Throwable cause = throwable.getCause();
			if (cause != null && exceptionClass.isAssignableFrom(cause.getClass())) {
				return (T) cause;
			}
		}
		Throwable[] throwables = throwable.getSuppressed();
		if (ArrayUtil.isNotEmpty(throwables)) {
			for (Throwable throwable1 : throwables) {
				if (exceptionClass.isAssignableFrom(throwable1.getClass())) {
					return (T) throwable1;
				}
			}
		}
		return null;
	}
831010
public static Throwable unwrap(Throwable t) {
        for (;;) {
            if (t == null)
                throw new NullPointerException();

            if (t instanceof java.util.concurrent.ExecutionException)
                t = t.getCause();
            else if (t instanceof java.lang.reflect.InvocationTargetException)
                t = t.getCause();
            else if (t.getClass().equals(RuntimeException.class) && t.getCause() != null)
                t = t.getCause();
            else
                return t;
        }
    }
121053
public boolean hasException(Class<? extends Throwable> type) {
        for (Throwable exception : exceptions) {
            if (type.isInstance(exception)) {
                return true;
            }
        }
        
        return false;
    }
1370479
private Object fromClass(final Class cl) throws Throwable {
    if (cl == null) {
      error("Must supply a class or have type attribute");
      return null;
    }

    return cl.newInstance();
  }
49120
private boolean detectLogFromBugsnag(Throwable throwable) {
        // Check all places that LOGGER is called with an exception in the Bugsnag library
        for (StackTraceElement element : throwable.getStackTrace()) {
            for (String excludedClass : EXCLUDED_CLASSES) {
                if (element.getClassName().startsWith(excludedClass)) {
                    return true;
                }
            }
        }

        return false;
    }
296884
public <T1 extends Throwable> 
                RuntimeException throwIf(Class<T1> t1) 
                throws T1 {
        return throwIf(t1, NULL_EX, NULL_EX, NULL_EX);
    }
1283115
static Throwable[] getSuppressed(Throwable throwable) {
    try {
      Method getSuppressed = throwable.getClass().getMethod("getSuppressed");
      return (Throwable[]) getSuppressed.invoke(throwable);
    } catch (NoSuchMethodException e) {
      return new Throwable[0];
    } catch (IllegalAccessException e) {
      throw new RuntimeException(e);
    } catch (InvocationTargetException e) {
      throw new RuntimeException(e);
    }
  }
981153
public static void throwChecked(Throwable t) {
    if (t == null) {
      throw new AssertionError("null");
    }
    Exceptions.<RuntimeException>throwIt(t);
  }
158892
public MethodHandle throwException() {
        if (type().parameterCount() != 1 || !Throwable.class.isAssignableFrom(type().parameterType(0))) {
            throw new InvalidTransformException("incoming signature must have one Throwable type as its sole argument: " + type());
        }
        return invoke(MethodHandles.throwException(type().returnType(), type().parameterType(0).asSubclass(Throwable.class)));
    }
14923
@SuppressWarnings("unchecked")
	public static boolean isCausedBy(@Nullable Throwable throwable,
			Class<? extends Exception>... causeExceptionClasses) {
		Throwable cause = throwable;

		while (cause != null) {
			for (Class<? extends Exception> causeClass : causeExceptionClasses) {
				if (causeClass.isInstance(cause)) {
					return true;
				}
			}
			cause = cause.getCause();
		}
		return false;
	}