diff options
Diffstat (limited to 'src/db/files.rs')
| -rw-r--r-- | src/db/files.rs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/db/files.rs b/src/db/files.rs index 995a2ed..f9b669d 100644 --- a/src/db/files.rs +++ b/src/db/files.rs @@ -1,7 +1,6 @@ use chrono::{DateTime, Local}; use tokio_rusqlite::{named_params, Connection, Result}; -use crate::db::utils; use crate::model::{decode_datetime, encode_datetime, File}; pub async fn insert(conn: &Connection, file: File) -> Result<()> { @@ -20,7 +19,6 @@ pub async fn insert(conn: &Connection, file: File) -> Result<()> { ":content_length": file.content_length ], ) - .map_err(tokio_rusqlite::Error::Rusqlite) }) .await .map(|_| ()) @@ -54,12 +52,16 @@ pub async fn get(conn: &Connection, file_id: impl Into<String>) -> Result<Option expires_at, content_length, })), - _ => Err(utils::rusqlite_other_error(format!( - "Error decoding datetime: {expires_at}" - ))), + _ => { + log::error!("Error decoding datetime: {expires_at}"); + Ok(None) + } } } - Some(_) => Err(utils::rusqlite_other_error("Error reading file in DB")), + Some(_) => { + log::error!("Error reading file in DB"); + Ok(None) + }, None => Ok(None), } }) |
