if_error: if not found, present a not found message

This commit is contained in:
Robur 2021-06-09 14:25:00 +00:00
parent f5d6475d2d
commit 901c24ab27

View file

@ -64,7 +64,7 @@ let if_error ?(status = `Internal_Server_Error) ?(log=(fun e -> Log.warn (fun m
let* r = r in
match r with
| Error `Not_found ->
Lwt_result.fail (message, `Not_Found)
Lwt_result.fail ("Resource not found", `Not_Found)
| Error (#Model.error as e) ->
log e;
Lwt_result.fail (message, status)