diff --git a/oab/src/api/app.rs b/oab/src/api/app.rs index 2d9526a..857baed 100644 --- a/oab/src/api/app.rs +++ b/oab/src/api/app.rs @@ -22,7 +22,10 @@ use crate::{ pub async fn get(id: web::Path, stat: web::Data) -> Result { let n = id.into_inner(); if !n.is_empty() { - let s = app::Entity::find_by_id(n).one(stat.db()).await?; + let s = app::Entity::find_by_id(&n).one(stat.db()).await?; + if s.is_none() { + return Err(Error::NotFound(n)); + } Ok(web::Json(s)) } else { Err(Error::Missing("id".to_string()))