mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-17 19:35:00 -04:00
only print some exceptions when in LogLevel >= DEBUG
This commit is contained in:
parent
480e5db1ab
commit
6a5862f6d0
@ -23,6 +23,7 @@ import de.bixilon.minosoft.game.datatypes.objectLoader.recipes.Recipes;
|
||||
import de.bixilon.minosoft.game.datatypes.objectLoader.versions.Version;
|
||||
import de.bixilon.minosoft.game.datatypes.objectLoader.versions.Versions;
|
||||
import de.bixilon.minosoft.logging.Log;
|
||||
import de.bixilon.minosoft.logging.LogLevels;
|
||||
import de.bixilon.minosoft.ping.ServerListPing;
|
||||
import de.bixilon.minosoft.protocol.modding.channels.DefaultPluginChannels;
|
||||
import de.bixilon.minosoft.protocol.modding.channels.PluginChannelHandler;
|
||||
@ -217,7 +218,9 @@ public class Connection {
|
||||
try {
|
||||
Versions.loadVersionMappings(version.getProtocolVersion());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
if (Log.getLevel().ordinal() >= LogLevels.DEBUG.ordinal()) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Log.fatal(String.format("Could not load mapping for %s. This version seems to be unsupported!", version));
|
||||
network.lastException = new RuntimeException(String.format("Mappings could not be loaded: %s", e.getLocalizedMessage()));
|
||||
setConnectionState(ConnectionStates.FAILED_NO_RETRY);
|
||||
@ -267,7 +270,9 @@ public class Connection {
|
||||
packet.log();
|
||||
packet.handle(getHandler());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
if (Log.getLevel().ordinal() >= LogLevels.DEBUG.ordinal()) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -14,6 +14,7 @@
|
||||
package de.bixilon.minosoft.protocol.network;
|
||||
|
||||
import de.bixilon.minosoft.logging.Log;
|
||||
import de.bixilon.minosoft.logging.LogLevels;
|
||||
import de.bixilon.minosoft.protocol.packets.ClientboundPacket;
|
||||
import de.bixilon.minosoft.protocol.packets.ServerboundPacket;
|
||||
import de.bixilon.minosoft.protocol.packets.clientbound.interfaces.PacketCompressionInterface;
|
||||
@ -227,7 +228,9 @@ public class Network {
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.protocol(String.format("An error occurred while parsing an packet (%s): %s", packet, e));
|
||||
e.printStackTrace();
|
||||
if (Log.getLevel().ordinal() >= LogLevels.DEBUG.ordinal()) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
disconnect();
|
||||
@ -238,7 +241,9 @@ public class Network {
|
||||
if (socketSThread != null) {
|
||||
socketSThread.interrupt();
|
||||
}
|
||||
e.printStackTrace();
|
||||
if (Log.getLevel().ordinal() >= LogLevels.DEBUG.ordinal()) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
socketRThread.setName(String.format("%d/Socket", connection.getConnectionId()));
|
||||
|
@ -14,6 +14,8 @@
|
||||
package de.bixilon.minosoft.util;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import de.bixilon.minosoft.logging.Log;
|
||||
import de.bixilon.minosoft.logging.LogLevels;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
@ -33,7 +35,9 @@ public final class HTTP {
|
||||
try {
|
||||
return client.send(request, HttpResponse.BodyHandlers.ofString());
|
||||
} catch (IOException | InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
if (Log.getLevel().ordinal() >= LogLevels.DEBUG.ordinal()) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParseException;
|
||||
import com.google.gson.JsonParser;
|
||||
import de.bixilon.minosoft.logging.Log;
|
||||
import de.bixilon.minosoft.logging.LogLevels;
|
||||
import de.bixilon.minosoft.util.HTTP;
|
||||
|
||||
import java.net.http.HttpResponse;
|
||||
@ -52,7 +53,9 @@ public final class MojangStatus {
|
||||
return ret;
|
||||
|
||||
} catch (NullPointerException | JsonParseException e) {
|
||||
e.printStackTrace();
|
||||
if (Log.getLevel().ordinal() >= LogLevels.DEBUG.ordinal()) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return getUnknownStatusMap();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user