This repository was archived by the owner on Sep 20, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
src/main/java/net/cryptic_game/server/microservice Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change 99import org .json .simple .JSONObject ;
1010import org .json .simple .parser .JSONParser ;
1111import org .json .simple .parser .ParseException ;
12+ import org .slf4j .Logger ;
13+ import org .slf4j .LoggerFactory ;
1214
1315import java .util .UUID ;
1416
15- import static net .cryptic_game .server .error .ServerError .*;
17+ import static net .cryptic_game .server .error .ServerError .MISSING_ACTION ;
18+ import static net .cryptic_game .server .error .ServerError .MISSING_PARAMETERS ;
19+ import static net .cryptic_game .server .error .ServerError .UNKNOWN_ACTION ;
20+ import static net .cryptic_game .server .error .ServerError .UNSUPPORTED_FORMAT ;
1621import static net .cryptic_game .server .socket .SocketServerUtils .sendRaw ;
1722
1823public class MicroServiceHandler extends SimpleChannelInboundHandler <String > {
1924
25+ private static final Logger log = LoggerFactory .getLogger (MicroServiceHandler .class );
26+
2027 @ Override
2128 protected void channelRead0 (ChannelHandlerContext ctx , String msg ) {
2229 Channel channel = ctx .channel ();
@@ -119,4 +126,9 @@ public void handlerRemoved(ChannelHandlerContext ctx) {
119126 MicroService .unregister (ctx .channel ());
120127 }
121128
129+ @ Override
130+ public void exceptionCaught (ChannelHandlerContext ctx , Throwable cause ) throws Exception {
131+ log .error ("Error in channel " + ctx .toString (), cause );
132+ ctx .close ().syncUninterruptibly ();
133+ }
122134}
You can’t perform that action at this time.
0 commit comments