Stop failing in destructors

I'm not sure what the right thing to do is here, but ignoring errors is
what the standard library does.
This commit is contained in:
Steven Fackler 2014-04-06 23:37:17 -07:00
parent f4c36647b4
commit 48501cfb73

View File

@ -190,14 +190,6 @@ macro_rules! check_desync(
) )
) )
macro_rules! fail_unless_failing(
($($t:tt)*) => (
if !task::failing() {
fail!($($t)*)
}
)
)
pub mod error; pub mod error;
pub mod pool; pub mod pool;
mod message; mod message;
@ -405,11 +397,7 @@ struct InnerPostgresConnection {
impl Drop for InnerPostgresConnection { impl Drop for InnerPostgresConnection {
fn drop(&mut self) { fn drop(&mut self) {
if !self.finished { if !self.finished {
match self.finish_inner() { let _ = self.finish_inner();
Ok(()) | Err(PgStreamDesynchronized) => {}
Err(err) =>
fail_unless_failing!("Error dropping connection: {}", err)
}
} }
} }
} }
@ -886,11 +874,7 @@ pub struct PostgresTransaction<'conn> {
impl<'conn> Drop for PostgresTransaction<'conn> { impl<'conn> Drop for PostgresTransaction<'conn> {
fn drop(&mut self) { fn drop(&mut self) {
if !self.finished { if !self.finished {
match self.finish_inner() { let _ = self.finish_inner();
Ok(()) | Err(PgStreamDesynchronized) => {}
Err(err) =>
fail_unless_failing!("Error dropping transaction: {}", err)
}
} }
} }
} }
@ -1013,11 +997,7 @@ pub struct PostgresStatement<'conn> {
impl<'conn> Drop for PostgresStatement<'conn> { impl<'conn> Drop for PostgresStatement<'conn> {
fn drop(&mut self) { fn drop(&mut self) {
if !self.finished.get() { if !self.finished.get() {
match self.finish_inner() { let _ = self.finish_inner();
Ok(()) | Err(PgStreamDesynchronized) => {}
Err(err) =>
fail_unless_failing!("Error dropping statement: {}", err)
}
} }
} }
} }
@ -1227,11 +1207,7 @@ pub struct PostgresRows<'stmt> {
impl<'stmt> Drop for PostgresRows<'stmt> { impl<'stmt> Drop for PostgresRows<'stmt> {
fn drop(&mut self) { fn drop(&mut self) {
if !self.finished { if !self.finished {
match self.finish_inner() { let _ = self.finish_inner();
Ok(()) | Err(PgStreamDesynchronized) => {}
Err(err) =>
fail_unless_failing!("Error dropping result: {}", err)
}
} }
} }
} }