Package com.enonic.xp.util
Class Exceptions
- java.lang.Object
-
- com.enonic.xp.util.Exceptions
-
@PublicApi public abstract class Exceptions extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classExceptions.Builder<T extends Throwable>
-
Constructor Summary
Constructors Constructor Description Exceptions()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Exceptions.Builder<RuntimeException>newRuntime(String message, Object... args)static RuntimeExceptionunchecked(Throwable e)Rethrows a checked exception as unchecked exception.
-
-
-
Method Detail
-
newRuntime
public static Exceptions.Builder<RuntimeException> newRuntime(String message, Object... args)
-
unchecked
public static RuntimeException unchecked(Throwable e)
Rethrows a checked exception as unchecked exception. This method tricks the compiler into thinking the exception is unchecked, rather than wrapping the given exception in a newRuntimeException. This method never returns. Nevertheless, it specifies a return type so it can be invoked asthrow unchecked(e)in contexts where an exception type is syntactically required (e.g. when the enclosing method is non-void).- Parameters:
e- Throwable to be made unchecked.- Returns:
- This will never return anything. It's here to trick the compiler.
-
-