mirror of
https://github.com/project-redbud/FunGame-Server.git
synced 2026-06-04 19:42:12 +00:00
记录最后一次发生的异常
This commit is contained in:
parent
2b3ff5770d
commit
1598eef40b
@ -60,6 +60,11 @@ namespace Milimoe.FunGame.Server.Services.DataUtility
|
||||
/// </summary>
|
||||
public override DataSet DataSet => _dataSet;
|
||||
|
||||
/// <summary>
|
||||
/// 最后一次执行命令时发生的异常
|
||||
/// </summary>
|
||||
public override Exception? LastException => _lastException;
|
||||
|
||||
/// <summary>
|
||||
/// SQL 语句参数
|
||||
/// </summary>
|
||||
@ -73,6 +78,7 @@ namespace Milimoe.FunGame.Server.Services.DataUtility
|
||||
private readonly SQLServerInfo? _serverInfo;
|
||||
private int _affectedRows = 0;
|
||||
private long _lastInsertId = 0;
|
||||
private Exception? _lastException = null;
|
||||
|
||||
public MySQLHelper(string script = "", CommandType type = CommandType.Text)
|
||||
{
|
||||
@ -167,6 +173,7 @@ namespace Milimoe.FunGame.Server.Services.DataUtility
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_lastException = e;
|
||||
if (localTransaction) Rollback();
|
||||
_result = SQLResult.SQLError;
|
||||
ServerHelper.Error(e);
|
||||
@ -231,6 +238,7 @@ namespace Milimoe.FunGame.Server.Services.DataUtility
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_lastException = e;
|
||||
if (localTransaction) Rollback();
|
||||
_result = SQLResult.SQLError;
|
||||
ServerHelper.Error(e);
|
||||
@ -295,6 +303,7 @@ namespace Milimoe.FunGame.Server.Services.DataUtility
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_lastException = e;
|
||||
if (localTransaction) Rollback();
|
||||
_result = SQLResult.SQLError;
|
||||
ServerHelper.Error(e);
|
||||
@ -359,6 +368,7 @@ namespace Milimoe.FunGame.Server.Services.DataUtility
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_lastException = e;
|
||||
if (localTransaction) Rollback();
|
||||
_result = SQLResult.SQLError;
|
||||
ServerHelper.Error(e);
|
||||
@ -395,6 +405,7 @@ namespace Milimoe.FunGame.Server.Services.DataUtility
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_lastException = e;
|
||||
_result = SQLResult.SQLError;
|
||||
ServerHelper.Error(e);
|
||||
}
|
||||
@ -416,6 +427,7 @@ namespace Milimoe.FunGame.Server.Services.DataUtility
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_lastException = e;
|
||||
_result = SQLResult.SQLError;
|
||||
ServerHelper.Error(e);
|
||||
}
|
||||
@ -438,6 +450,7 @@ namespace Milimoe.FunGame.Server.Services.DataUtility
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_lastException = e;
|
||||
ServerHelper.Error(e);
|
||||
_result = SQLResult.SQLError;
|
||||
return false;
|
||||
|
||||
@ -60,6 +60,11 @@ namespace Milimoe.FunGame.Server.Services.DataUtility
|
||||
/// </summary>
|
||||
public override DataSet DataSet => _dataSet;
|
||||
|
||||
/// <summary>
|
||||
/// 最后一次执行命令时发生的异常
|
||||
/// </summary>
|
||||
public override Exception? LastException => _lastException;
|
||||
|
||||
/// <summary>
|
||||
/// SQL 语句参数
|
||||
/// </summary>
|
||||
@ -73,6 +78,7 @@ namespace Milimoe.FunGame.Server.Services.DataUtility
|
||||
private readonly SQLServerInfo? _serverInfo;
|
||||
private int _affectedRows = 0;
|
||||
private long _lastInsertId = 0;
|
||||
private Exception? _lastException = null;
|
||||
|
||||
public SQLiteHelper(string script = "", CommandType type = CommandType.Text)
|
||||
{
|
||||
@ -167,6 +173,7 @@ namespace Milimoe.FunGame.Server.Services.DataUtility
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_lastException = e;
|
||||
if (localTransaction) Rollback();
|
||||
_result = SQLResult.SQLError;
|
||||
ServerHelper.Error(e);
|
||||
@ -233,6 +240,7 @@ namespace Milimoe.FunGame.Server.Services.DataUtility
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_lastException = e;
|
||||
if (localTransaction) Rollback();
|
||||
_result = SQLResult.SQLError;
|
||||
ServerHelper.Error(e);
|
||||
@ -298,6 +306,7 @@ namespace Milimoe.FunGame.Server.Services.DataUtility
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_lastException = e;
|
||||
if (localTransaction) Rollback();
|
||||
_result = SQLResult.SQLError;
|
||||
ServerHelper.Error(e);
|
||||
@ -363,6 +372,7 @@ namespace Milimoe.FunGame.Server.Services.DataUtility
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_lastException = e;
|
||||
if (localTransaction) Rollback();
|
||||
_result = SQLResult.SQLError;
|
||||
ServerHelper.Error(e);
|
||||
@ -399,6 +409,7 @@ namespace Milimoe.FunGame.Server.Services.DataUtility
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_lastException = e;
|
||||
_result = SQLResult.SQLError;
|
||||
ServerHelper.Error(e);
|
||||
}
|
||||
@ -420,6 +431,7 @@ namespace Milimoe.FunGame.Server.Services.DataUtility
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_lastException = e;
|
||||
_result = SQLResult.SQLError;
|
||||
ServerHelper.Error(e);
|
||||
}
|
||||
@ -442,6 +454,7 @@ namespace Milimoe.FunGame.Server.Services.DataUtility
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_lastException = e;
|
||||
ServerHelper.Error(e);
|
||||
_result = SQLResult.SQLError;
|
||||
return false;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user