Merge branch 'jshs-std-error' into v0.0.9

This commit is contained in:
John Gallagher 2015-02-13 15:45:53 -05:00
commit 21e0a5493d

View File

@ -57,6 +57,7 @@ extern crate libc;
use std::mem; use std::mem;
use std::ptr; use std::ptr;
use std::fmt; use std::fmt;
use std::error;
use std::rc::{Rc}; use std::rc::{Rc};
use std::cell::{RefCell, Cell}; use std::cell::{RefCell, Cell};
use std::ffi::{CString}; use std::ffi::{CString};
@ -100,8 +101,14 @@ pub struct SqliteError {
} }
impl fmt::Display for SqliteError { impl fmt::Display for SqliteError {
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "SqliteError( code: {}, message: {} )", self.code, self.message) write!(f, "{} (SQLite error {})", self.message, self.code)
}
}
impl error::Error for SqliteError {
fn description(&self) -> &str {
ffi::code_to_str(self.code)
} }
} }