AnyLogic
Expand
Font size

@AnyLogicInternalAPI
public final class UtilitiesError
extends Object

Method Summary

Modifier and TypeMethodDescription
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
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
static RuntimeExceptionerror(String errorText)
Creates and throws new RuntimeException
static RuntimeExceptionerror(String errorTextFormat, Object... args)
Creates and throws new RuntimeException with message using format syntax like in String.format(String, Object...) method
static RuntimeExceptionerror(Throwable cause, String errorText)
Creates and throws new RuntimeException
static RuntimeExceptionerror(Throwable cause, String errorTextFormat, Object... args)
Creates and throws new RuntimeException with message using format syntax like in String.format(String, Object...) method
static StringformatSafe(String messageFormat, Object... messageArgs)
static Class<?>getClassSafe(Object obj) 
static voidprocessThreadDeath(Throwable e)
Rethrows e if it is ThreadDeath
static StringtoStringSafe(Object o) 
static StringtoStringStackTrace(Throwable e) 

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Method Details

error

public static RuntimeException error(String errorText)
Creates and throws new RuntimeException

error

public static RuntimeException error(Throwable cause,
 String errorText)
Creates and throws new RuntimeException

error

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
See Also:

error

public static RuntimeException error(String errorTextFormat,
 Object... args)
Creates and throws new RuntimeException with message using format syntax like in String.format(String, Object...) method
See Also:

dropLastFromStack

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
Type Parameters:
T -
Parameters:
throwable -
Returns:
given throwable, for convenience

dropLastFromStack

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
Type Parameters:
T -
Parameters:
throwable -
Returns:
given throwable, for convenience

processThreadDeath

@AnyLogicInternalAPI
public static void processThreadDeath(Throwable e)
Rethrows e if it is ThreadDeath
Parameters:
e -
See Also:
ThreadDeath

formatSafe

public static String formatSafe(String messageFormat,
 Object... messageArgs)
Safe analog of String.format(String, Object...). Doesn't fail in case of message format errors.

toStringStackTrace

public static String toStringStackTrace(Throwable e)
Returns:
stack trace as a string

toStringSafe

public static String toStringSafe(Object o)

getClassSafe

public static Class<?> getClassSafe(Object obj)