From c6ad7016d36b8a0741133169f4dbc8230f580868 Mon Sep 17 00:00:00 2001 From: Mili Date: Tue, 21 Feb 2023 23:30:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FunGame.Server/Main.cs | 5 +++-- FunGame.Server/Model/ServerModel.cs | 3 +-- FunGame.Server/Utility/Utility.cs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/FunGame.Server/Main.cs b/FunGame.Server/Main.cs index 0c488f3..a76aa3c 100644 --- a/FunGame.Server/Main.cs +++ b/FunGame.Server/Main.cs @@ -1,4 +1,5 @@ -using Milimoe.FunGame.Core.Api.Utility; +using Milimoe.FunGame; +using Milimoe.FunGame.Core.Api.Utility; using Milimoe.FunGame.Core.Library.Common.Network; using Milimoe.FunGame.Core.Library.Constant; using Milimoe.FunGame.Server.Model; @@ -77,7 +78,7 @@ void StartServer() if (!DataHelper.Connect()) { Running = false; - throw new Exception("服务器遇到问题需要关闭,请重新启动服务器!"); + throw new ServerErrorException(); } // 创建监听 diff --git a/FunGame.Server/Model/ServerModel.cs b/FunGame.Server/Model/ServerModel.cs index 6e13bc8..52f594b 100644 --- a/FunGame.Server/Model/ServerModel.cs +++ b/FunGame.Server/Model/ServerModel.cs @@ -72,7 +72,6 @@ namespace Milimoe.FunGame.Server.Model break; } return Send(socket, type, msg); - throw new Exception(); } catch (Exception e) { @@ -97,7 +96,7 @@ namespace Milimoe.FunGame.Server.Model ServerHelper.WriteLine("[" + ServerSocket.GetTypeString(type) + "] " + SocketHelper.MakeClientName(ClientName, User) + " <- " + obj); return true; } - throw new Exception("无法向客户端传输消息。"); + throw new CanNotSendToClientException(); } catch (Exception e) { diff --git a/FunGame.Server/Utility/Utility.cs b/FunGame.Server/Utility/Utility.cs index ad33cab..27f7f3a 100644 --- a/FunGame.Server/Utility/Utility.cs +++ b/FunGame.Server/Utility/Utility.cs @@ -69,7 +69,7 @@ namespace Milimoe.FunGame.Server.Utility } else { - throw new Exception("MySQL服务启动失败:无法找到MySQL配置文件。"); + throw new MySQLConfigException(); } } catch (Exception e)