From 51e90e5334b79ec308e71b148a2410e7911c22a7 Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Tue, 26 Apr 2022 13:50:28 +0800 Subject: [PATCH] Update error message --- .../SqlSugar/Abstract/AdoProvider/AdoProvider.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Src/Asp.Net/SqlSugar/Abstract/AdoProvider/AdoProvider.cs b/Src/Asp.Net/SqlSugar/Abstract/AdoProvider/AdoProvider.cs index b415128ac..b244d4120 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/AdoProvider/AdoProvider.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/AdoProvider/AdoProvider.cs @@ -369,6 +369,7 @@ namespace SqlSugar } catch (Exception ex) { + SugarCatch(ex, sql,parameters); CommandType = CommandType.Text; if (ErrorEvent != null) ExecuteErrorEvent(sql, parameters, ex); @@ -408,6 +409,7 @@ namespace SqlSugar } catch (Exception ex) { + SugarCatch(ex, sql, parameters); CommandType = CommandType.Text; if (ErrorEvent != null) ExecuteErrorEvent(sql, parameters, ex); @@ -440,6 +442,7 @@ namespace SqlSugar } catch (Exception ex) { + SugarCatch(ex, sql, parameters); CommandType = CommandType.Text; if (ErrorEvent != null) ExecuteErrorEvent(sql, parameters, ex); @@ -475,6 +478,7 @@ namespace SqlSugar } catch (Exception ex) { + SugarCatch(ex, sql, parameters); CommandType = CommandType.Text; if (ErrorEvent != null) ExecuteErrorEvent(sql, parameters, ex); @@ -515,6 +519,7 @@ namespace SqlSugar } catch (Exception ex) { + SugarCatch(ex, sql, parameters); CommandType = CommandType.Text; if (ErrorEvent != null) ExecuteErrorEvent(sql, parameters, ex); @@ -559,6 +564,7 @@ namespace SqlSugar } catch (Exception ex) { + SugarCatch(ex, sql, parameters); CommandType = CommandType.Text; if (ErrorEvent != null) ExecuteErrorEvent(sql, parameters, ex); @@ -594,6 +600,7 @@ namespace SqlSugar } catch (Exception ex) { + SugarCatch(ex, sql, parameters); CommandType = CommandType.Text; if (ErrorEvent != null) ExecuteErrorEvent(sql, parameters, ex); @@ -1282,6 +1289,14 @@ namespace SqlSugar #endregion #region Helper + + private void SugarCatch(Exception ex, string sql, SugarParameter[] parameters) + { + if (sql != null && sql.Contains("{year}{month}{day}")) + { + Check.ExceptionEasy("need .SplitTable() message:" + ex.Message, "当前代码是否缺少 .SplitTable() ,可以看文档 [分表] , 详细错误:" + ex.Message); + } + } public virtual void RemoveCancellationToken() { this.CancellationToken = null;