sihl icon indicating copy to clipboard operation
sihl copied to clipboard

Sihl.Database.query should raise error

Open joseferben opened this issue 3 years ago • 0 comments

Currently a query looks like

let get ~id =
    Database.query (fun connection ->
        let module Connection = (val connection : Caqti_lwt.CONNECTION) in
        Connection.find_opt get_request id |> Lwt.map Database.raise_error)
  ;;

instead we could get rid of raise_error and just have

  let get ~id =
    Database.query (fun connection ->
        let module Connection = (val connection : Caqti_lwt.CONNECTION) in
        Connection.find_opt get_request id)
  ;;

joseferben avatar Mar 06 '21 10:03 joseferben