Return error 404 if thread is empty

This commit is contained in:
silverpill 2021-10-08 12:56:02 +00:00
parent 16b606bf06
commit aac3d89f21

View file

@ -204,6 +204,9 @@ pub async fn get_thread(
let posts: Vec<Post> = rows.iter()
.map(|row| Post::try_from(row))
.collect::<Result<_, _>>()?;
if posts.len() == 0 {
return Err(DatabaseError::NotFound("post"));
}
Ok(posts)
}