Revert all InvalidColumnType stuff

This commit is contained in:
gwenn 2016-07-02 11:50:39 +02:00
parent 3eb3b22ad5
commit 038ef2de42
3 changed files with 8 additions and 10 deletions

View File

@ -50,7 +50,7 @@ pub enum Error {
/// Error when the value of a particular column is requested, but the type of the result in /// Error when the value of a particular column is requested, but the type of the result in
/// that column cannot be converted to the requested Rust type. /// that column cannot be converted to the requested Rust type.
InvalidColumnType(c_int, c_int), InvalidColumnType,
/// Error when a query that was expected to insert one row did not insert any or insert many. /// Error when a query that was expected to insert one row did not insert any or insert many.
StatementChangedRows(c_int), StatementChangedRows(c_int),
@ -109,9 +109,7 @@ impl fmt::Display for Error {
Error::QueryReturnedNoRows => write!(f, "Query returned no rows"), Error::QueryReturnedNoRows => write!(f, "Query returned no rows"),
Error::InvalidColumnIndex(i) => write!(f, "Invalid column index: {}", i), Error::InvalidColumnIndex(i) => write!(f, "Invalid column index: {}", i),
Error::InvalidColumnName(ref name) => write!(f, "Invalid column name: {}", name), Error::InvalidColumnName(ref name) => write!(f, "Invalid column name: {}", name),
Error::InvalidColumnType(i, t) => { Error::InvalidColumnType => write!(f, "Invalid column type"),
write!(f, "Invalid column type {} at index: {}", t, i)
}
Error::StatementChangedRows(i) => write!(f, "Query changed {} rows", i), Error::StatementChangedRows(i) => write!(f, "Query changed {} rows", i),
Error::StatementFailedToInsertRow => write!(f, "Statement failed to insert new row"), Error::StatementFailedToInsertRow => write!(f, "Statement failed to insert new row"),
@ -144,7 +142,7 @@ impl error::Error for Error {
Error::QueryReturnedNoRows => "query returned no rows", Error::QueryReturnedNoRows => "query returned no rows",
Error::InvalidColumnIndex(_) => "invalid column index", Error::InvalidColumnIndex(_) => "invalid column index",
Error::InvalidColumnName(_) => "invalid column name", Error::InvalidColumnName(_) => "invalid column name",
Error::InvalidColumnType(_, _) => "invalid column type", Error::InvalidColumnType => "invalid column type",
Error::StatementChangedRows(_) => "query inserted zero or more than one row", Error::StatementChangedRows(_) => "query inserted zero or more than one row",
Error::StatementFailedToInsertRow => "statement failed to insert new row", Error::StatementFailedToInsertRow => "statement failed to insert new row",
@ -171,7 +169,7 @@ impl error::Error for Error {
Error::QueryReturnedNoRows | Error::QueryReturnedNoRows |
Error::InvalidColumnIndex(_) | Error::InvalidColumnIndex(_) |
Error::InvalidColumnName(_) | Error::InvalidColumnName(_) |
Error::InvalidColumnType(_, _) | Error::InvalidColumnType |
Error::InvalidPath(_) | Error::InvalidPath(_) |
Error::StatementChangedRows(_) | Error::StatementChangedRows(_) |
Error::StatementFailedToInsertRow => None, Error::StatementFailedToInsertRow => None,

View File

@ -1489,7 +1489,7 @@ mod test {
.collect(); .collect();
match bad_type.unwrap_err() { match bad_type.unwrap_err() {
Error::InvalidColumnType(_, _) => (), Error::InvalidColumnType => (),
err => panic!("Unexpected error {}", err), err => panic!("Unexpected error {}", err),
} }
@ -1549,7 +1549,7 @@ mod test {
.collect(); .collect();
match bad_type.unwrap_err() { match bad_type.unwrap_err() {
CustomError::Sqlite(Error::InvalidColumnType(_, _)) => (), CustomError::Sqlite(Error::InvalidColumnType) => (),
err => panic!("Unexpected error {}", err), err => panic!("Unexpected error {}", err),
} }
@ -1611,7 +1611,7 @@ mod test {
}); });
match bad_type.unwrap_err() { match bad_type.unwrap_err() {
CustomError::Sqlite(Error::InvalidColumnType(_, _)) => (), CustomError::Sqlite(Error::InvalidColumnType) => (),
err => panic!("Unexpected error {}", err), err => panic!("Unexpected error {}", err),
} }

View File

@ -176,7 +176,7 @@ mod test {
fn test_mismatched_types() { fn test_mismatched_types() {
fn is_invalid_column_type(err: Error) -> bool { fn is_invalid_column_type(err: Error) -> bool {
match err { match err {
Error::InvalidColumnType(_, _) => true, Error::InvalidColumnType => true,
_ => false, _ => false,
} }
} }