Package de.gurkenlabs.litiengine
Class DefaultUncaughtExceptionHandler
java.lang.Object
de.gurkenlabs.litiengine.DefaultUncaughtExceptionHandler
- All Implemented Interfaces:
java.lang.Thread.UncaughtExceptionHandler
public class DefaultUncaughtExceptionHandler
extends java.lang.Object
implements java.lang.Thread.UncaughtExceptionHandler
Handles the uncaught exceptions that might occur while running a game or application with the LITIENGINE.
It provides proper logging of the exception in a crash.txt
file in the game's root directory that can be
further used to report the issue if it's a generic one.
- See Also:
ClientConfiguration.exitOnError()
Constructor Summary
Constructors Constructor Description DefaultUncaughtExceptionHandler(boolean exitOnException)
Initializes a new instance of theDefaultUncaughtExceptionHandler
class.Method Summary
Modifier and Type Method Description boolean
exitOnException()
Indicates whether this hander currently exits the game upon an unhandled exception.void
setExitOnException(boolean exit)
Set whether the game will exit upon an unhandled exception.void
uncaughtException(java.lang.Thread t, java.lang.Throwable e)
Constructor Details
DefaultUncaughtExceptionHandler
public DefaultUncaughtExceptionHandler(boolean exitOnException)Initializes a new instance of theDefaultUncaughtExceptionHandler
class.- Parameters:
exitOnException
- A flag indicating whether the game should exit when an unexpected error occurs.
Method Details
uncaughtException
public void uncaughtException(java.lang.Thread t, java.lang.Throwable e)- Specified by:
uncaughtException
in interfacejava.lang.Thread.UncaughtExceptionHandler
exitOnException
public boolean exitOnException()Indicates whether this hander currently exits the game upon an unhandled exception.- Returns:
- True if the game will exit upon an unhandled exception; otherwise false.
setExitOnException
public void setExitOnException(boolean exit)Set whether the game will exit upon an unhandled exception.- Parameters:
exit
- The flag that defines whether the game will exit upon an unhandled exception.