增加了两个数据库异常
This commit is contained in:
parent
4e125a229d
commit
e92721b499
|
@ -0,0 +1,45 @@
|
|||
using SqlSugar;
|
||||
using System;
|
||||
using System.Data.Common;
|
||||
using System.Text;
|
||||
|
||||
namespace Falcon.SugarApi.DatabaseManager
|
||||
{
|
||||
/// <summary>
|
||||
/// 数据库输出参数值错误
|
||||
/// </summary>
|
||||
public class DatabaseOutputParameterException:Exception
|
||||
{
|
||||
/// <summary>
|
||||
/// 参数引用
|
||||
/// </summary>
|
||||
public DbParameter Parameter { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 通过参数名和当前值构造错误DbParameter
|
||||
/// </summary>
|
||||
/// <param name="parameterName">参数名</param>
|
||||
/// <param name="parameterValue">参数值</param>
|
||||
public DatabaseOutputParameterException(string parameterName,string? parameterValue = null)
|
||||
: base("存储过程输出参数返回值错误") {
|
||||
this.Parameter = new SugarParameter(parameterName,parameterValue);
|
||||
}
|
||||
/// <summary>
|
||||
/// 通过参数名和当前值构造错误
|
||||
/// </summary>
|
||||
/// <param name="parameter"></param>
|
||||
public DatabaseOutputParameterException(DbParameter parameter)
|
||||
: base("存储过程输出参数返回值错误") {
|
||||
Parameter = parameter;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override string ToString() {
|
||||
var sb = new StringBuilder();
|
||||
sb.AppendLine("存储过程输出参数返回值错误!");
|
||||
sb.AppendLine($"参数:{this.Parameter.ParameterName}:{this.Parameter.Value}");
|
||||
sb.AppendLine(base.ToString());
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -17,4 +17,12 @@ namespace Falcon.SugarApi.DatabaseManager
|
|||
/// <param name="innException">内部异常</param>
|
||||
public DatabaseTranException(Exception innException) : base("执行数据库事务时发生异常!",innException) { }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 存储过程执行异常
|
||||
/// </summary>
|
||||
public class DatabaseStoredProceduresExcuteException:Exception
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user