diff --git a/src/main/java/nl/iobyte/themeparkconnector/api/network/drivers/SystemDriver.java b/src/main/java/nl/iobyte/themeparkconnector/api/network/drivers/SystemDriver.java index 32e0c20..f5f1e97 100755 --- a/src/main/java/nl/iobyte/themeparkconnector/api/network/drivers/SystemDriver.java +++ b/src/main/java/nl/iobyte/themeparkconnector/api/network/drivers/SystemDriver.java @@ -12,6 +12,8 @@ import nl.iobyte.themeparkconnector.api.state.states.ConnectedState; import nl.iobyte.themeparkconnector.api.state.states.IdleState; import nl.iobyte.themeparkconnector.logger.ThemeParkConnectorLogger; +import java.util.Arrays; + public class SystemDriver extends SocketDriver { /** @@ -60,10 +62,22 @@ public class SystemDriver extends SocketDriver { api.getStateService().setState(new IdleState("Socket connection error")); api.getPlayerStateService().stop(); - ThemeParkConnectorLogger.toConsole(ThemeParkConnector.getGson().toJson(args)); + Arrays.stream(args).filter(arg -> { + if(!(arg instanceof Throwable)) + return false; + + ((Throwable) arg).printStackTrace(); + return false; + }).forEach(arg -> ThemeParkConnectorLogger.toConsole(ThemeParkConnector.getGson().toJson(arg))); }); - socket.on(Manager.EVENT_ERROR, args -> ThemeParkConnectorLogger.toConsole(ThemeParkConnector.getGson().toJson(args))); + socket.on(Manager.EVENT_ERROR, args -> Arrays.stream(args).filter(arg -> { + if(!(arg instanceof Throwable)) + return false; + + ((Throwable) arg).printStackTrace(); + return false; + }).forEach(arg -> ThemeParkConnectorLogger.toConsole(ThemeParkConnector.getGson().toJson(arg)))); } /**