public static SQLite3.Result Checked(this IPreparedSqliteOperation This, int sqlite3ErrorCode, string message = null) { var result = (SQLite3.Result)sqlite3ErrorCode; if (result == SQLite3.Result.OK || result == SQLite3.Result.Done || result == SQLite3.Result.Row) { return(result); } var err = raw.sqlite3_errmsg(This.Connection.Handle); var ex = new SQLiteException(result, (message ?? "") + ": " + err); This.Log().WarnException(message, ex); throw ex; }
public static SQLite3.Result Checked(this IPreparedSqliteOperation connection, int sqlite3ErrorCode, string message = null) { var result = (SQLite3.Result)sqlite3ErrorCode; if (result == SQLite3.Result.OK || result == SQLite3.Result.Done || result == SQLite3.Result.Row) { return(result); } var err = raw.sqlite3_errmsg(connection.Connection.Handle).utf8_to_string(); var ex = new SQLiteException(result, (message ?? string.Empty) + ": " + err); connection.Log().Warn(ex, message); throw ex; }