コード例 #1
0
 public void TimesOut(Connection connection, Request request)
 {
     try
     {
         gameLogic.TimesOut(request.LastPlayerWantsToLeave());
         connection.SendMessage(BuildResponse(ResponseCode.Ok));
     }
     catch (TimesOutException e)
     {
         connection.SendMessage(BuildResponse(ResponseCode.GameFinished, e.Message));
         connection.Close();
     }catch (LastPlayerAbandonedGameException e)
     {
         connection.SendMessage(BuildResponse(ResponseCode.BadRequest, e.Message));
         connection.Close();
     }
     catch (RecordNotFoundException e)
     {
         connection.SendMessage(BuildResponse(ResponseCode.NotFound, e.Message));
     }
     catch (ClientNotConnectedException e)
     {
         connection.SendMessage(BuildResponse(ResponseCode.Unauthorized, e.Message));
     }
 }