Added uncaught exception handler
This commit is contained in:
parent
ec6181aaa8
commit
996a244649
@ -17,10 +17,23 @@
|
||||
*******************************************************************************/
|
||||
package ru.windcorp.progressia;
|
||||
|
||||
import ru.windcorp.progressia.common.util.crash.CrashReports;
|
||||
import ru.windcorp.progressia.common.util.crash.analyzers.OutOfMemoryAnalyzer;
|
||||
import ru.windcorp.progressia.common.util.crash.providers.OSContextProvider;
|
||||
|
||||
public class ProgressiaLauncher {
|
||||
|
||||
public static void launch(String[] args, Proxy proxy) {
|
||||
setupCrashReports();
|
||||
proxy.initialize();
|
||||
}
|
||||
|
||||
private static void setupCrashReports() {
|
||||
CrashReports.registerProvider(new OSContextProvider());
|
||||
CrashReports.registerAnalyzer(new OutOfMemoryAnalyzer());
|
||||
Thread.setDefaultUncaughtExceptionHandler((Thread thread, Throwable t)-> {
|
||||
CrashReports.report(t,"Uncaught exception in thread %s", thread.getName());
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -20,9 +20,6 @@ package ru.windcorp.progressia.client;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import ru.windcorp.progressia.ProgressiaLauncher;
|
||||
import ru.windcorp.progressia.common.util.crash.CrashReports;
|
||||
import ru.windcorp.progressia.common.util.crash.analyzers.OutOfMemoryAnalyzer;
|
||||
import ru.windcorp.progressia.common.util.crash.providers.OSContextProvider;
|
||||
|
||||
public class ProgressiaClientMain {
|
||||
|
||||
@ -31,15 +28,6 @@ public class ProgressiaClientMain {
|
||||
public static void main(String[] args) {
|
||||
logger.info("App started!");
|
||||
|
||||
CrashReports.registerProvider(new OSContextProvider());
|
||||
CrashReports.registerAnalyzer(new OutOfMemoryAnalyzer());
|
||||
try {
|
||||
@SuppressWarnings("unused")
|
||||
long[] ssdss = new long[1 << 30];
|
||||
} catch (Throwable t) {
|
||||
CrashReports.report(t, "u %s stupid", "vry");
|
||||
}
|
||||
|
||||
ProgressiaLauncher.launch(args, new ClientProxy());
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user