Package com.anylogic.engine
- java.lang.Object
- com.anylogic.engine.UtilitiesError
@AnyLogicInternalAPI public final class UtilitiesError extends Object
Modifier and Type | Method | Description |
---|---|---|
static <T extends Throwable> | dropLastFromStack |
Removes last element from stack trace of the given throwable
This method may be used in private check/ensure-methods |
static <T extends Throwable> | dropLastFromStack |
Removes last elements from stack trace of the given throwable
This method may be used in private check/ensure-methods |
static RuntimeException | error | |
static RuntimeException | error | |
static RuntimeException | error | |
static RuntimeException | error |
Creates and throws new
RuntimeException with message using format syntax like
in String.format(String, Object...) method |
static String | formatSafe |
Safe analog of
String.format(String, Object...) . |
static Class<?> | getClassSafe | |
static RuntimeException | getRuntimeException | |
static void | processThreadDeath |
Rethrows e if it is
ThreadDeath |
static String | toStringSafe | |
static String | toStringStackTrace | |
static String | toStringWithCauses |
Returns toString of the given throwable and all its causers
|
public static RuntimeException error(String errorText)
- See Also:
public static RuntimeException error(Throwable cause, String errorText)
- See Also:
public static RuntimeException error(String errorTextFormat, Object... args)
- See Also:
public static RuntimeException error(Throwable cause, String errorTextFormat, Object... args)
Creates and throws new
RuntimeException
with message using format syntax like
in String.format(String, Object...)
method- Parameters:
cause
- the exception which caused this error to happen- Returns:
- this method is declared to return RuntimeException just for convenience (it may be useful sometimes to write
throw error(...)
to tell compiler that the next line of code will not happen to execute), but it will never return it. - See Also:
public static RuntimeException getRuntimeException(Throwable e)
public static <T extends Throwable> T dropLastFromStack(T throwable)
Removes last element from stack trace of the given throwable
This method may be used in private check/ensure-methods
This method may be used in private check/ensure-methods
- Type Parameters:
T
-- Parameters:
throwable
-- Returns:
- given
throwable
, for convenience
public static <T extends Throwable> T dropLastFromStack(T throwable, int count)
Removes last elements from stack trace of the given throwable
This method may be used in private check/ensure-methods
This method may be used in private check/ensure-methods
- Type Parameters:
T
-- Parameters:
throwable
-- Returns:
- given
throwable
, for convenience
@AnyLogicInternalAPI public static void processThreadDeath(Throwable e)
Rethrows e if it is
ThreadDeath
- Parameters:
e
-- See Also:
-
ThreadDeath
public static String formatSafe(String messageFormat, Object... messageArgs)
Safe analog of
String.format(String, Object...)
. Doesn't fail in case of message format errors.public static String toStringStackTrace(Throwable e)
- Returns:
- stack trace as a string
public static String toStringWithCauses(Throwable e)
Returns toString of the given throwable and all its causers
- Parameters:
e
-- Returns:
- toString of the given throwable and all its causers
public static String toStringSafe(Object o)
public static Class<?> getClassSafe(Object obj)