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)