mirror of
https://github.com/Start9Labs/patch-db.git
synced 2026-03-26 10:21:53 +00:00
fix: Remove an unwrap (#35)
* chore: Remove an unwrap * chore: convert to a potential error instead, older api * chore: format file
This commit is contained in:
@@ -121,7 +121,11 @@ where
|
||||
self.set_(db_handle, new_value, &[]).await
|
||||
}
|
||||
pub async fn get<DH: DbHandle>(&self, db_handle: &mut DH) -> Result<T, Error> {
|
||||
self.get_(db_handle, &[]).await.map(|x| x.unwrap())
|
||||
self.get_(db_handle, &[]).await.and_then(|x| {
|
||||
x.map(Ok).unwrap_or_else(|| {
|
||||
serde_json::from_value(serde_json::Value::Null).map_err(Error::JSON)
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
impl<T> LockReceipt<T, String>
|
||||
|
||||
Reference in New Issue
Block a user