com.emarsys.ecommon.exceptions
Class Exceptions
java.lang.Object
com.emarsys.ecommon.exceptions.Exceptions
public class Exceptions
- extends java.lang.Object
Various utilties for dealing with Exception
s
or Throwable
s respectively.
- Author:
- Michael "kULO" Kulovits
Method Summary |
static java.lang.Runnable |
getRunnableIgnoringRuntimeExceptions(java.lang.Runnable runnable,
java.lang.Class<?> callerClass)
Returns a Runnable that performs the same
Runnable.run() operation as the passed instance, but
will catch any arising RuntimeException s and print
an error message to a Log for the passed caller
Class instance. |
static java.lang.String |
getStackTrace(java.lang.Throwable t)
Prints the stacktrace of the passed Throwable to
a String . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SCENARIO_RUNTIME_DEFAULT_NAME
public static final java.lang.String SCENARIO_RUNTIME_DEFAULT_NAME
- See Also:
- Constant Field Values
SCENARIO_RUNTIME_DEFAULT
public static final ExceptionScenario<java.lang.RuntimeException,java.lang.RuntimeException> SCENARIO_RUNTIME_DEFAULT
Exceptions
public Exceptions()
getStackTrace
public static java.lang.String getStackTrace(java.lang.Throwable t)
- Prints the stacktrace of the passed
Throwable
to
a String
.
- Parameters:
t
- - the Throwable
, must not be null
- Returns:
- always a valid
String
instance,
never null
.
- Throws:
java.lang.NullPointerException
- - if the passed Throwable
is
null
getRunnableIgnoringRuntimeExceptions
public static java.lang.Runnable getRunnableIgnoringRuntimeExceptions(java.lang.Runnable runnable,
java.lang.Class<?> callerClass)
- Returns a
Runnable
that performs the same
Runnable.run()
operation as the passed instance, but
will catch any arising RuntimeException
s and print
an error message to a Log
for the passed caller
Class
instance.
- Parameters:
runnable
- - the runnable to be wrappedcallerClass
- - the calling class to get a Log
for
- Returns:
- always a valid
Runnable
instance,
never null
.
Copyright © 2010 emarsys AG. All Rights Reserved.