replace try\!
with ?
This commit is contained in:
parent
f9a9aca2f5
commit
3a8e3c7e78
1 changed files with 6 additions and 6 deletions
|
@ -34,15 +34,15 @@ impl Store {
|
||||||
pub fn new(database: Option<String>) -> Result<Store, cli::Error> {
|
pub fn new(database: Option<String>) -> Result<Store, cli::Error> {
|
||||||
let db_name = database.unwrap_or("".to_string());
|
let db_name = database.unwrap_or("".to_string());
|
||||||
|
|
||||||
let mut handle = try!(new_connection(&db_name));
|
let mut handle = new_connection(&db_name)?;
|
||||||
let conn = try!(Conn::connect(&mut handle));
|
let conn = Conn::connect(&mut handle)?;
|
||||||
Ok(Store { handle, conn, db_name })
|
Ok(Store { handle, conn, db_name })
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn open(&mut self, database: Option<String>) -> Result<(), cli::Error> {
|
pub fn open(&mut self, database: Option<String>) -> Result<(), cli::Error> {
|
||||||
self.db_name = database.unwrap_or("".to_string());
|
self.db_name = database.unwrap_or("".to_string());
|
||||||
self.handle = try!(new_connection(&self.db_name));
|
self.handle = new_connection(&self.db_name)?;
|
||||||
self.conn = try!(Conn::connect(&mut self.handle));
|
self.conn = Conn::connect(&mut self.handle)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,10 +52,10 @@ impl Store {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn query(&self, query: String) -> Result<QueryResults, cli::Error> {
|
pub fn query(&self, query: String) -> Result<QueryResults, cli::Error> {
|
||||||
Ok(try!(self.conn.q_once(&self.handle, &query, None)))
|
Ok(self.conn.q_once(&self.handle, &query, None)?)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn transact(&mut self, transaction: String) -> Result<TxReport, cli::Error> {
|
pub fn transact(&mut self, transaction: String) -> Result<TxReport, cli::Error> {
|
||||||
Ok(try!(self.conn.transact(&mut self.handle, &transaction)))
|
Ok(self.conn.transact(&mut self.handle, &transaction)?)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue