mirror of
https://github.com/mitb-archive/filebot
synced 2024-12-23 08:18:52 -05:00
33 lines
524 B
Java
33 lines
524 B
Java
|
|
package net.sourceforge.tuned;
|
|
|
|
|
|
public final class ExceptionUtil {
|
|
|
|
public static Throwable getRootCause(Throwable t) {
|
|
while (t.getCause() != null) {
|
|
t = t.getCause();
|
|
}
|
|
|
|
return t;
|
|
}
|
|
|
|
|
|
public static RuntimeException asRuntimeException(Throwable t) {
|
|
if (t instanceof RuntimeException) {
|
|
return (RuntimeException) t;
|
|
}
|
|
|
|
return new RuntimeException(t);
|
|
}
|
|
|
|
|
|
/**
|
|
* Dummy constructor to prevent instantiation.
|
|
*/
|
|
private ExceptionUtil() {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
|
|
}
|