/// <summary> /// Constructor to use. Takes MySqlException to display. /// </summary> /// <param name="e">MySqlException to show.</param> /// <param name="status">Table engine statuses to display in advanced information.</param> public SqlErrorDialog(DbException e, string status) { if (e == null) throw new ArgumentNullException("e"); if (status == null) throw new ArgumentNullException("status"); InitializeComponent(); // Load error icon imageList.Images.Add(SystemIcons.Error); iconLabel.ImageIndex = 0; // Fill text boxes errorText.Text = e.Message; statusText.Text = status; // We try to recognize, if this exception is MySqlException // For this we'll use reflection. We'll try to find property "Number" Type exceptionType = e.GetType(); Debug.Assert(exceptionType != null, "Failed to retrieve type information for exception!"); // Extract property information PropertyInfo numberProperty = exceptionType.GetProperty("Number"); // If there is Number property, extract its value object numberValueObject = null; if (numberProperty != null) { try { // Try to get value of Number property numberValueObject = numberProperty.GetValue(e, null); } catch (Exception ex) { // This is bad, but not fatal - we can show unknown error code Debug.Fail("Failed to get value for Number property!", ex.ToString()); } } else { // This is bad, but not fatal - we can show unknown error code Debug.Fail("Failed to extract Number property description!"); } // If extracted value is not null, convert it to string and append to error label if (numberValueObject != null) errorLabel.Text = String.Format(CultureInfo.CurrentCulture, errorLabel.Text, numberValueObject.ToString()); // If value is null, append unknow error code else errorLabel.Text = String.Format(CultureInfo.CurrentCulture, errorLabel.Text, Resources.UnknownErrorCode); }
private DbException HandleUniqueException(string message, Exception exception) { var result = new DbException(exception.Message, exception) { IsDuplicateKeyViolation = true }; return result; }
private DbException HandleForeignKey(string message, SqlException exception) { var result = new DbException(message, exception) { IsForeignKeyViolation = true }; return result; }
public void Constructor1Test() { const string message = "Message"; DbException dbException = new DbException(message); Assert.AreEqual(message, dbException.Message); Assert.IsNull(dbException.InnerException); Assert.IsNull(dbException.Params); Assert.IsNull(dbException.StoredProcedureName); }
public void Constructor2Test() { const string message = "Message"; InvalidOperationException exception = new InvalidOperationException(); DbException dbException = new DbException(message, exception); Assert.AreEqual(message, dbException.Message); Assert.AreEqual(exception, dbException.InnerException); Assert.IsNull(dbException.Params); Assert.IsNull(dbException.StoredProcedureName); }
public void Constructor4Test() { const string message = "Message"; const string sp = "storedprocedure"; InvalidOperationException exception = new InvalidOperationException(); ICollection<DbParam> @params = new Collection<DbParam>(); DbException dbException = new DbException(message, exception, sp, @params); Assert.AreEqual(message, dbException.Message); Assert.AreEqual(exception, dbException.InnerException); Assert.AreEqual(@params, dbException.Params); Assert.AreEqual(sp, dbException.StoredProcedureName); }
// Translate Method public override Exception Translate(IDbCommand command, DbException ex) { var sqlException = ex as SqlException; if (sqlException == null) return ex; if (sqlException.Number == SqlErrorCode.UniqueIndexViolation) return new DuplicateCommitException(Exceptions.DuplicateCommit.FormatWith(command.GetParameterValue("@id"))); if (sqlException.Number == SqlErrorCode.UniqueConstraintViolation) return new ConcurrencyException(Exceptions.CommitConcurrencyConflict.FormatWith(command.GetParameterValue("@streamId"), command.GetParameterValue("@version"))); return base.Translate(command, ex); }
public override bool IsDbBusy(DbException ex) { if (_transientErrors.Any(err => ex.Message.Contains(err))) { "SqlServer".LogWarn(ex.Message); return true; } if (ex.Message.Contains("imeout")) { "SqlServer".LogWarn("Connection timeout"); return true; } return false; }
/// <summary> /// Checks if an exception was raised due to a connection error. /// </summary> /// <param name="e">Exception raised.</param> /// <returns>True if the exception was due to a connection problem, False otherwise.</returns> public abstract bool IsConnectionException(DbException e);
public DBErrorType GetDBErrorType(DbException ex) { return(((OracleException)ex).GetDBErrorType()); }
public DBErrorType GetDBErrorType(DbException ex) { return(DBErrorType.UNDEFINED); }
/// <summary> /// Turns all NpgsqlException into DBExceptions. /// Error Codes: http://www.postgresql.org/docs/9.1/static/errcodes-appendix.html /// </summary> /// <param name="ex">A NpgsqlException to handle.</param> /// <author>Jannik Arndt, Bernd Nottbeck</author> public override void HandleException(DbException ex) { //NpgsqlException ex NpgsqlException exception = ex as NpgsqlException; if (exception != null) { switch (exception.Code) { case "01000": throw new DBException("Warning! " + exception.Message, ex); //throw new WarningException(ex.Message, ex); case "08000": throw new NoConnectionException(exception.Message, ex); case "28000": throw new WrongCredentialsException(exception.Message, ex); case "28P01": throw new WrongCredentialsException(exception.Message, ex); case "3D000": throw new DatabaseDoesNotExist(exception.Message, ex); default: throw new DBException(exception.Message + exception.Code, ex); } } throw ex; }
/// <summary> /// 对数据访问类执行 T-SQL 并返回影响的行数 /// </summary> /// <param name="sql"></param> /// <exception cref="DbException"></exception> /// <returns></returns> public override int ExecSql(string sql) { int result; try { SqlConnection sqlConnection = (SqlConnection)Open(); SqlCommand sqlCommand = new SqlCommand(sql, sqlConnection); result = sqlCommand.ExecuteNonQuery(); } catch (Exception innerException) { DbException exception = new DbException(string.Format("执行 ExecSql 时发生意外:{0}", sql), innerException); exception.Sql = sql; throw exception; } return result; }
public static string DBExceptionString(DbException dbx, string sql) { return LMLoggers.LognLM.FlattenChars(dbx.GetType().Name + "'" + dbx.Message + "' " + dbx.ErrorCode.ToString("x8") + "; " + sql); }
/// <summary> /// Checks if an exception was raised due to a timeout. /// This implementation checks if the exception is a <see cref="DbException"/>, and its error code is -2. /// </summary> /// <param name="exception">Exception raised.</param> /// <returns>True if the exception was due to a timeout, False otherwise.</returns> public virtual bool IsTimeoutException(Exception exception) { DbException dbException = exception as DbException; return(dbException != null && dbException.ErrorCode == TimeoutErrorCode); }
public static async Task <List <T> > GetAll <T>(object value, string field = IdField) where T : class, new() { Debug.WriteLine(ObjectHelper.GetCaller() + ": " + ObjectHelper.GetType <T>() + " where " + field + " = " + value); if (isOnline) { if (dbCon.IsConnect()) { string query = "SELECT * FROM " + typeof(T).Name.ToLower() + "s WHERE " + field + " = " + value + ";"; var cmd = new MySqlCommand(query, dbCon.Connection); var reader = cmd.ExecuteReader(); List <T> list = new List <T>(); PropertyInfo[] props = ObjectHelper.GetReflectionProperties(new T()); while (reader.Read()) { T obj = new T(); for (int i = 0; i < reader.FieldCount; i++) { try { PropertyInfo propertyInfo = obj.GetType().GetProperty(props[i].Name); propertyInfo.SetValue(obj, Convert.ChangeType(reader.GetValue(i), propertyInfo.PropertyType), null); } catch { continue; } } list.Add(obj); } reader.Close(); dbCon.Close(); foreach (var res in list) { Debug.WriteLine(ObjectHelper.GetCaller() + " RESULT: " + ObjectHelper.ToString(res)); } return(list); } dbCon.Close(); } else { if (!DbException.CheckDatabaseConnection(conn)) { return(null); } var item = Expression.Parameter(typeof(T), "item"); var prop = Expression.Property(item, field); var soap = Expression.Constant(value); var equal = Expression.Equal(prop, soap); var lambda = Expression.Lambda <Func <T, bool> >(equal, item); var query = await conn.Table <T>().Where(lambda).ToListAsync(); return(query); } return(null); }
/// <summary> /// Attempts to make a connection to the underlying database. /// </summary> /// <remarks> /// This value is cached to avoid multiple connections to /// the same destination. /// </remarks> /// <exception cref="DbException">If the connection attempt fails.</exception> public void Validate() { if (this.exception != null) { throw this.exception; } using (var connection = this.CreateConnection()) { try { connection.Open(); } catch (DbException ex) { this.exception = ex; throw; } } }
public static bool CheckDatabaseConnection() { return(DbException.CheckDatabaseConnection(conn)); }
public static async Task <int> Insert(object item, bool skipId = true) { Debug.WriteLine(ObjectHelper.GetCaller() + ": " + ObjectHelper.ToString(item)); if (!isOnline) { if (!DbException.CheckDatabaseConnection(conn)) { return(0); } return(await conn.InsertAsync(item)); } else { if (dbCon.IsConnect()) { PropertyInfo[] props = ObjectHelper.GetReflectionProperties(item, true); string query = "INSERT INTO " + item.GetType().Name.ToLower() + "s ("; string queryEnd = ""; for (int i = 0; i < props.Length; i++) { if (props[i].Name == "Id" && skipId) { continue; } query = query + props[i].Name; string value = Convert.ToString(item.GetType().GetProperty(props[i].Name).GetValue(item, null)); if (typeof(DateTime).IsAssignableFrom(props[i].PropertyType)) { DateTime dateTime = (DateTime)item.GetType().GetProperty(props[i].Name).GetValue(item, null); value = dateTime.ToString("yyyy-MM-dd HH:mm:ss"); } if (typeof(bool).IsAssignableFrom(props[i].PropertyType)) { queryEnd = queryEnd + SqlHelper.Escape(value); } else { queryEnd = queryEnd + "'" + SqlHelper.Escape(value) + "'"; } if (i != props.Length - 1) { query = query + ", "; queryEnd = queryEnd + ", "; } else { query = query + ")"; queryEnd = queryEnd + ")"; } } query = query + " VALUES (" + queryEnd + ";SELECT LAST_INSERT_ID();"; var cmd = new MySqlCommand(query, dbCon.Connection); var newId = cmd.ExecuteScalar(); Debug.WriteLine("Inserted ID:" + newId); return(Convert.ToInt32(newId)); } dbCon.Close(); } return(0); }
/// <summary> /// Analyzes the given DB Exception for retrieving more infomation /// about the error. /// </summary> /// <param name="messageId">User Message Id retrieved from Db Exception. /// Applicable only when return value is DbError.Application</param> /// <param name="execption"></param> /// <param name="message"></param> public static DbError ParseDbException(DbException execption, out string message) { const string MessageIdKey1 = "[**WKFS_MESSAGE:"; const string MessageIdKey2 = "**]"; int messageId = 0; // Search for special keys within the exception message message = execption.Message; var key1Index = message.IndexOf(MessageIdKey1, System.StringComparison.Ordinal); if (key1Index >= 0) { var start = key1Index + MessageIdKey1.Length; var end = message.IndexOf(MessageIdKey2, start, System.StringComparison.Ordinal); if (end >= 0) { // Found, parse the message id if (int.TryParse(message.Substring(start, end - start), out messageId)) { return(DbError.Application); } } } // Handle Sql Server specific error code var sqlExecption = execption as System.Data.SqlClient.SqlException; if (null == sqlExecption) { return(DbError.Unknown); } bool isConstraintViolation = false; if (sqlExecption.Number == 547) { isConstraintViolation = true; } else if (sqlExecption.Number == 50000 && (message.IndexOf("Error Number: 547", System.StringComparison.Ordinal) >= 0 || message.IndexOf("Error Number: 2627", System.StringComparison.Ordinal) >= 0)) { // Our Common logging sp converts sql errors into user // errors and original sql error can be found in message // string - so here we have again found constraint // violation error. isConstraintViolation = true; } // In case of constraint violation, see if its foregin key or // unique key or primary key if (isConstraintViolation) { if (message.IndexOf("REFERENCE", System.StringComparison.Ordinal) >= 0) { return(DbError.ForeignKeyViolation); } else if (message.IndexOf("PRIMARY KEY", System.StringComparison.Ordinal) >= 0) { return(DbError.PrimaryKeyViolation); } else if (message.IndexOf("UNIQUE KEY", System.StringComparison.Ordinal) >= 0) { return(DbError.UniqueKeyViolation); } } return(DbError.Unknown); }
private static string ExtractErrorCode(DbException sqlx) { string msg = sqlx.Message; return(msg.Split(':')[1].Split(' ', '\t')[0]); }
private static bool IsBusinessRuleException(DbException sqlx) { string msg = sqlx.Message.ToUpper(); return(msg.Split(':')[0].Trim().Equals("BRE")); }
///<summary>Extract the name of the violated constraint from the given SQLException.</summary> /// <param name="sqle">The exception that was the result of the constraint violation.</param> /// <returns>The extracted constraint name.</returns> public override string ExtractConstraintName(DbException sqle) { return ExtractUsingTemplate("constraint (", ") violated", sqle.Message); }
private CustomException ProcessException(DbException e) { string msg = e.Message; if (regex.Match(e.Message).Success) { msg = e.Message; } else { msg = e.Message; } return new CustomException(msg, e); }
/// <summary> /// Handle DB specific exceptions. /// Write errors to console only. /// </summary> /// <param name="dbx">the exception</param> /// <param name="sql">the SQL statement text that threw the error</param> /// <returns>return true if exception is from the preferred provider and no database was found, so that caller may try to create a new database</returns> public static bool DBExceptionHandler(DbException dbx, string sql) { bool neednew = false; //if (dbx is System.Data.SqlServerCe.SqlCeException) // SQL Server CE -- specific test against various SQL errors v. the no database found error //{ // System.Data.SqlServerCe.SqlCeException x = (System.Data.SqlServerCe.SqlCeException)dbx; // //x.NativeError == // DBMain.AltLog(LogLevels.Warning, 70147, DBExceptionString(dbx, sql)); //} //else if (dbx is System.Data.SQLite.SQLiteException) // SQLite3 -- specific test against various SQL errors v. the no database found error { System.Data.SQLite.SQLiteException x = (System.Data.SQLite.SQLiteException)dbx; if (x.ResultCode == SQLiteErrorCode.Error) // SQL error or missing database { neednew = !(dbx.Message.EndsWith("syntax error") || // not an SQL syntax error dbx.Message.Contains("no such table") ||//or malformed schema, dbx.Message.Contains("has no column named")); // nor mismatched column, but likely a missing DB if (!neednew) { DBMain.AltLog(LogLevels.Warning, 70136, DBExceptionString(dbx, sql), true); } } else { DBMain.AltLog(LogLevels.Warning, 70137, DBExceptionString(dbx, sql)); } } else if (dbx is System.Data.OleDb.OleDbException) // Access { DBMain.AltLog(LogLevels.Warning, 70140, DBExceptionString(dbx, sql)); // todo: expand when the "no DB present" code is known } else if (dbx is System.Data.Common.DbException) // anything else { DBMain.AltLog(LogLevels.Warning, 70139, DBExceptionString(dbx, sql)); // todo: expand when the "no DB present" code is known } else { Console.WriteLine(DBExceptionString(dbx, sql)); } return neednew; }
/// <summary> /// Translate the specified <see cref="DbException"/> if required. /// </summary> /// <param name="command">The <see cref="IDbCommand"/> that generated the exception.</param> /// <param name="ex">The exception to translate.</param> public virtual Exception Translate(IDbCommand command, DbException ex) { return ex; }
/// <summary> /// Shows error dialog. /// </summary> /// <param name="e">MySqlException to show.</param> /// <param name="status">Table engine statuses to display in advanced information.</param> public static void ShowError(DbException e, string status) { if (e == null) throw new ArgumentNullException("e"); if (status == null) throw new ArgumentNullException("status"); SqlErrorDialog dialog = new SqlErrorDialog(e, status); UIHelper.ShowDialog(dialog); }
private void GotDbException(DbException exception) { MessageBox.Show(exception.Message); }
/// <summary> /// </summary> /// <param name="serr"> </param> /// <returns> </returns> public static Exception OnAgebullDatabaseException(DbException serr) { return(new AgebullSystemException("系统内部错误", SystemErrorType.DataBaseError, serr.Message, serr)); }
public virtual string ExtractConstraintName(DbException sqle) { return null; }
/// <summary> /// 对数据访问类执行 T-SQL 并返回一个数据指针 /// </summary> /// <param name="sql"></param> /// <exception cref="DbException"></exception> /// <returns></returns> public override Cursor Query(string sql) { Cursor cursor; try { SqlConnection sqlConnection = (SqlConnection)Open(); SqlCommand sqlCommand = new SqlCommand(sql, sqlConnection); SqlDataReader sqlDataReader = sqlCommand.ExecuteReader(CommandBehavior.Default); cursor = new Cursor(sqlDataReader); } catch (Exception exception) { DbException dbException = new DbException(string.Format("执行 Query 时发生意外:{0}", sql), exception); dbException.Sql = sql; throw dbException; } return cursor; }
public override bool IsUniqueViolation(DbException ex, string keyName = "") { if (!ex.Message.Contains("Cannot insert duplicate")) return false; return !keyName.IsNotEmpty() || ex.Message.Contains(keyName); }
public void ToStringWithNullParamsTest() { const string message = "Message"; const string sp = "storedprocedure"; InvalidOperationException exception = new InvalidOperationException(); DbException dbException = new DbException(message, exception, sp); const string expectedTostring = "Stored procedure: storedprocedure, params: , exception: CloudUri.DAL.Database.DbException: Message ---> System.InvalidOperationException: Operation is not valid due to the current state of the object.\r\n --- End of inner exception stack trace ---"; Assert.AreEqual(expectedTostring, dbException.ToString()); }
/// <summary> /// Обработка типовых исключений работы с БД MSSQL и FoxPro, с формированием сообщения о возможной причине. /// В случае, если исходное исключение не SqlException, не StorageException или /// не OleDbException - пробрасывается исходное. /// </summary> public static Exception HandleKnownDbFoxProAndMssqlServerExceptions(DbException ex) { const int mssqlDublicateRowErrorCode = 2627; const string mssqlDublicateMessage = "Одно или несколько полей добавляемой/редактируемой сущности " + "помечены признаком уникальности и уже есть в базе данных. Добавление ещё одного экземляра " + "сущности запрещено ключом уникальности."; const int mssqlDeleteReferencedRowErrorCode = 547; const string mssqlDeleteReferencedRowMessage = "Удаление указанной записи запрещено, так как на " + "неё есть как минимум одна действующая ссылка из других таблиц базы данных."; const int foxproWrongQueryErrorCode = -2147467259; const string foxProWrongQueryMessage = "Ошибка в SQL-запросе к базе данных FoxPro: несовпадение типов, " + "неверное имя столбца, отсутсвие столбца или что-то иное."; const int foxproFileAccessErrorCode = -2147217865; const string foxproFileAccessMessage = "Нет доступа к файлу (или отсутвует файл) базы " + "данных FoxPro для выполнения запроса."; var isDbException = ex is SqlException || ex is StorageException || ex is OleDbException; if (!isDbException) { return(ex); // Исключение является не SqlException, не StorageException, не OleDbException } var probableCause = string.Empty; // предполагаемая ошибка var currentInnerException = ex; do { var sqlException = currentInnerException as SqlException; var oleDbException = currentInnerException as OleDbException; if (sqlException != null) { var sqlErrorCode = sqlException.Errors[0].Number; if (sqlErrorCode == mssqlDublicateRowErrorCode) // Причина - дубликат по ключу уникальности { probableCause = mssqlDublicateMessage; break; } if (sqlErrorCode == mssqlDeleteReferencedRowErrorCode) // Причина - удаление связанной дочерней { probableCause = mssqlDeleteReferencedRowMessage; break; } } else if (oleDbException != null) { var oleDbErrorCode = oleDbException.ErrorCode; if (oleDbErrorCode == foxproWrongQueryErrorCode) // Причина - ошибочный запрос к FoxPro БД { probableCause = foxProWrongQueryMessage; break; } if (oleDbErrorCode == foxproFileAccessErrorCode) // Причина - недоступен файл FoxPro БД { probableCause = foxproFileAccessMessage; break; } } // следующее вложенное исключение currentInnerException = currentInnerException.InnerException as DbException; } while (currentInnerException != null); // Если неизвестная причина SqlException или OleDbException if (string.Empty.Equals(probableCause)) { return(new StorageException(ex.Message, ex)); } // Если SqlException или OleDbException с "возможной причиной" throw new StorageException(ex.Message, probableCause, ex); }
/// <summary> /// Obtiene un mensaje de error entendible para el usuario a partir de un objeto Exception /// </summary> /// <param name="e">Excepcion capturada que se dedea "Traducir"</param> /// <returns>Mensaje de error entendible</returns> private string obtenerError(DbException e) { string mensaje = e.Message; switch (base.MProveedor) { case "System.Data.SqlClient": { System.Data.SqlClient.SqlException ex = (System.Data.SqlClient.SqlException)e; switch (ex.Number) { case 547: { mensaje = "El registro se encuentra asociado en otra tabla."; break; } case 2627: { mensaje = "Uno de los valores ingresados ya se encuentra registrado."; break; } } break; } case "System.Data.OracleClient": { //System.Data.OracleClient.OracleException ex = (System.Data.OracleClient.OracleException)e; //switch (ex.Code) //{ // case 547: // { // mensaje = "El registro se encuentra asociado en otra tabla."; // break; // } //} break; } } return mensaje; }
/// <summary> /// Called after each retry when opening connection, must return true to continue retrying. /// >> Should this method be virtual? /// </summary> /// <param name="ex"></param> /// <param name="attempt"></param> /// <returns></returns> public abstract bool OnSqlErrorRetry(SdbConnection conn, DbException ex, int attempt);
public void ToStringTest() { const string message = "Message"; const string sp = "storedprocedure"; InvalidOperationException exception = new InvalidOperationException(); ICollection<DbParam> @params = new Collection<DbParam> { new DbParam { Direction = ParameterDirection.Output, Name = "@", Size = 4, Type = SqlDbType.Money, Value = 123 } }; DbException dbException = new DbException(message, exception, sp, @params); const string expectedTostring = "Stored procedure: storedprocedure, params: Name: @, Value: 123, Type: Money, Direction: Output, Size: 4, exception: CloudUri.DAL.Database.DbException: Message ---> System.InvalidOperationException: Operation is not valid due to the current state of the object.\r\n --- End of inner exception stack trace ---"; Assert.AreEqual(expectedTostring, dbException.ToString()); }
/// <summary> /// Generates universal MPM DBexceptions from DB Type specific exceptions. /// </summary> /// <param name="ex">DB type specific exception</param> public abstract void HandleException(DbException ex);
/// <summary> /// Extract the name of the violated constraint from the given DbException. /// </summary> /// <param name="sqle">The exception that was the result of the constraint violation.</param> /// <returns>The extracted constraint name.</returns> public override string ExtractConstraintName(DbException sqle) { string constraintName = null; var extracter = new ReflectionBasedSqlStateExtracter(); int errorCode = extracter.ExtractErrorCode(sqle); if (errorCode == -268) { constraintName = ExtractUsingTemplate("Unique constraint (", ") violated.", sqle.Message); } else if (errorCode == -691) { constraintName = ExtractUsingTemplate("Missing key in referenced table for referential constraint (", ").", sqle.Message); } else if (errorCode == -692) { constraintName = ExtractUsingTemplate("Key value for constraint (", ") is still being referenced.", sqle.Message); } if (constraintName != null) { // strip table-owner because Informix always returns constraint names as "<table-owner>.<constraint-name>" int i = constraintName.IndexOf('.'); if (i != -1) { constraintName = constraintName.Substring(i + 1); } } return constraintName; }
/// <summary> /// 当查询发生异常时 /// </summary> /// <param name="sender">产生事件的源</param> /// <param name="exception">异常信息</param> /// <param name="command">产生异常的命令对象</param> protected void OnError( object sender, DbException exception, IDbCommand command ) { EventHandler<DbErrorEventArgs> handler = Error; if ( handler != null ) { handler( sender, new DbErrorEventArgs( exception, command ) ); } }
public override bool ObjectExists(DbException ex, string name = null) => ex.Message.Contains("already an object named") && (ex.Message.Contains(name ?? " "));
/// <summary> /// Extract the name of the violated constraint from the given SQLException. /// </summary> /// <param name="sqle">The exception that was the result of the constraint violation. </param> /// <returns> The extracted constraint name. </returns> public abstract string ExtractConstraintName(DbException sqle);
/// <summary> /// The handle batch exception. /// </summary> /// <param name = "dbException">The db exception.</param> protected virtual void HandleBatchException(DbException dbException) { Exception = dbException; Messages += dbException.Message + Environment.NewLine; }
/// <summary> /// /// </summary> /// <param name="ex"></param> public override void HandleException(DbException ex) { Console.WriteLine("SQLite DbException: " + ex); if (ex is SQLiteException) { switch (((SQLiteException)ex).ErrorCode) { default: throw new DBException(ex.Message + "\nErrorCode: " + ((SQLiteException)ex).ErrorCode, ex); } } }
public DbErrorEventArgs( DbException exception, IDbCommand command ) { _exception = exception; _command = command; }
private static void Rethrow(DbException dbx) { throw dbx; }