Skip to content

Commit 3d44306

Browse files
authored
Handle case when items are empty
Add error handling for empty items in web.rs
1 parent 3494c5d commit 3d44306

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/bin/web.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,10 @@ async fn page(
107107
let item: Item = (&json).into();
108108
items.push(item);
109109
}
110+
if items.is_empty() {
111+
error!("{} not found", key);
112+
(StatusCode::NOT_FOUND, "Not found").into_response()
113+
}
110114
let url_path = format!("/{key}");
111115
let page_list = PageList {
112116
items,

0 commit comments

Comments
 (0)