[FIX] MainClass error handling

This commit is contained in:
Gravit 2020-03-15 03:12:16 +07:00
parent 1bbaadc5f1
commit d50c306e80
No known key found for this signature in database
GPG key ID: 061981E1E85D3216

View file

@ -34,10 +34,7 @@
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
import java.net.InetSocketAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.URL;
import java.net.*;
import java.nio.file.FileVisitResult;
import java.nio.file.Path;
import java.nio.file.SimpleFileVisitor;
@ -302,6 +299,10 @@ private static void launch(ClientProfile profile, Params params) throws Throwabl
// Invoke main method
try {
mainMethod.invokeWithArguments((Object) args.toArray(new String[0]));
LogHelper.debug("Main exit successful");
} catch (Throwable e) {
LogHelper.error(e);
throw e;
} finally {
LauncherEngine.exitLauncher(0);
}