mirror of
https://github.com/isar/rusqlite.git
synced 2024-11-29 21:52:12 +08:00
Merge branch 'jshs-std-error' into v0.0.9
This commit is contained in:
commit
21e0a5493d
11
src/lib.rs
11
src/lib.rs
@ -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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user