Error handling refactor and 500 page/message templates
This commit is contained in:
@@ -84,7 +84,7 @@ pub async fn insert_post(
|
||||
title: &str,
|
||||
content: &str,
|
||||
author: &Uuid,
|
||||
) -> Result<Uuid, AdminError> {
|
||||
) -> Result<Uuid, sqlx::Error> {
|
||||
let post_id = Uuid::new_v4();
|
||||
let query = sqlx::query!(
|
||||
r#"
|
||||
@@ -97,10 +97,7 @@ pub async fn insert_post(
|
||||
content,
|
||||
Utc::now()
|
||||
);
|
||||
transaction
|
||||
.execute(query)
|
||||
.await
|
||||
.map_err(|e| AdminError::UnexpectedError(e.into()))?;
|
||||
transaction.execute(query).await?;
|
||||
Ok(post_id)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user