macro_rules! found {
($option:expr, $ctx:expr $(,)?) => { ... };
($option:expr, $ctx:expr, $detail:expr $(,)?) => { ... };
}Expand description
Unwrap an Option, or return a 404.
The shape of nearly every READ handler: a row that is not there is not
an error the server made, it is a 404 with a sentence.
fn fetch(row: Option<Todo>, ctx: &Context) -> Result<Todo, JsonApiError> {
let todo = ash_jsonapi::found!(row, ctx, "no todo with that id");
Ok(todo)
}