Implement fmt::String for SqliteError

This commit is contained in:
John Gallagher 2015-01-10 20:50:03 -06:00
parent 8843d15a07
commit 680056b351

View File

@ -96,6 +96,12 @@ pub struct SqliteError {
pub message: String, pub message: String,
} }
impl fmt::String for SqliteError {
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
write!(f, "SqliteError( code: {}, message: {} )", self.code, self.message)
}
}
impl SqliteError { impl SqliteError {
fn from_handle(db: *mut ffi::Struct_sqlite3, code: c_int) -> SqliteError { fn from_handle(db: *mut ffi::Struct_sqlite3, code: c_int) -> SqliteError {
let message = if db.is_null() { let message = if db.is_null() {