FIX: logging issue for socket errors
This commit is contained in:
parent
85c0374628
commit
29e890c022
1 changed files with 16 additions and 2 deletions
|
@ -12,6 +12,8 @@ import nl.iobyte.themeparkconnector.api.state.states.ConnectedState;
|
||||||
import nl.iobyte.themeparkconnector.api.state.states.IdleState;
|
import nl.iobyte.themeparkconnector.api.state.states.IdleState;
|
||||||
import nl.iobyte.themeparkconnector.logger.ThemeParkConnectorLogger;
|
import nl.iobyte.themeparkconnector.logger.ThemeParkConnectorLogger;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
public class SystemDriver extends SocketDriver {
|
public class SystemDriver extends SocketDriver {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -60,10 +62,22 @@ public class SystemDriver extends SocketDriver {
|
||||||
api.getStateService().setState(new IdleState("Socket connection error"));
|
api.getStateService().setState(new IdleState("Socket connection error"));
|
||||||
api.getPlayerStateService().stop();
|
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))));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Reference in a new issue