cn.nukkit.utils.bugreport.ExceptionHandler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of powernukkit Show documentation
Show all versions of powernukkit Show documentation
A Minecraft Bedrock Edition server software implementation made in Java from scratch which supports all new features.
package cn.nukkit.utils.bugreport;
/**
* Project nukkit
*/
public class ExceptionHandler implements Thread.UncaughtExceptionHandler {
public static void registerExceptionHandler() {
Thread.setDefaultUncaughtExceptionHandler(new ExceptionHandler());
}
@Override
public void uncaughtException(Thread thread, Throwable throwable) {
handle(thread, throwable);
}
public void handle(Thread thread, Throwable throwable) {
throwable.printStackTrace();
try {
new BugReportGenerator(throwable).start();
} catch (Exception exception) {
// Fail Safe
}
}
}