review panic in InnerConnection.drop

This commit is contained in:
edelangh 2017-09-06 16:50:21 +02:00
parent 0d1907887e
commit ab643c90ce

View File

@ -871,14 +871,17 @@ impl InnerConnection {
} }
impl Drop for InnerConnection { impl Drop for InnerConnection {
#[cfg(not(test))]
#[allow(unused_must_use)] #[allow(unused_must_use)]
fn drop(&mut self) { fn drop(&mut self) {
self.close(); use std::thread::panicking;
if let Err(e) = self.close() {
if panicking() {
eprintln!("Error while closing SQLite connection: {:?}", e);
} else {
panic!("Error while closing SQLite connection: {:?}", e);
}
} }
#[cfg(test)]
fn drop(&mut self) {
self.close().expect("Error while closing SQLite connection");
} }
} }