Return error 404 if thread is empty
This commit is contained in:
parent
16b606bf06
commit
aac3d89f21
1 changed files with 3 additions and 0 deletions
|
@ -204,6 +204,9 @@ pub async fn get_thread(
|
||||||
let posts: Vec<Post> = rows.iter()
|
let posts: Vec<Post> = rows.iter()
|
||||||
.map(|row| Post::try_from(row))
|
.map(|row| Post::try_from(row))
|
||||||
.collect::<Result<_, _>>()?;
|
.collect::<Result<_, _>>()?;
|
||||||
|
if posts.len() == 0 {
|
||||||
|
return Err(DatabaseError::NotFound("post"));
|
||||||
|
}
|
||||||
Ok(posts)
|
Ok(posts)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue