Merge pull request 'map_err and bind_lwt_err will be deprecated with lwt.5.6.0' (#124) from upgrade-to-lwt-5.6.0 into main

Reviewed-on: https://git.robur.io/robur/builder-web/pulls/124
This commit is contained in:
Reynir Björnsson 2022-07-12 11:24:48 +00:00
commit af0bb71ee0
3 changed files with 4 additions and 4 deletions

View file

@ -22,7 +22,7 @@ depends: [
"cstruct" {>= "6.0.0"} "cstruct" {>= "6.0.0"}
"bos" "bos"
"hex" "hex"
"lwt" {>= "5.3.0"} "lwt" {>= "5.6.0"}
"caqti" {>= "1.8.0"} "caqti" {>= "1.8.0"}
"caqti-lwt" "caqti-lwt"
"caqti-driver-sqlite3" "caqti-driver-sqlite3"

View file

@ -240,7 +240,7 @@ module Viz_aux = struct
(Fpath.to_string viz_path) (Fpath.to_string viz_path)
Lwt_io.read Lwt_io.read
) )
|> Lwt_result.map_err (fun exn -> `Msg (Printexc.to_string exn)) |> Lwt_result.map_error (fun exn -> `Msg (Printexc.to_string exn))
|> if_error "Error getting cached visualization" |> if_error "Error getting cached visualization"
end end

View file

@ -315,7 +315,7 @@ let add_build
let job_name = job.Builder.name in let job_name = job.Builder.name in
let staging_dir = Fpath.(staging datadir / Uuidm.to_string uuid) in let staging_dir = Fpath.(staging datadir / Uuidm.to_string uuid) in
let or_cleanup x = let or_cleanup x =
Lwt_result.map_err (fun e -> Lwt_result.map_error (fun e ->
Bos.OS.Dir.delete ~recurse:true staging_dir Bos.OS.Dir.delete ~recurse:true staging_dir
|> Result.iter_error (fun e -> |> Result.iter_error (fun e ->
Log.err (fun m -> m "Failed to remove staging dir %a: %a" Log.err (fun m -> m "Failed to remove staging dir %a: %a"
@ -405,7 +405,7 @@ let add_build
commit_files datadir staging_dir job_name uuid >|= fun () -> commit_files datadir staging_dir job_name uuid >|= fun () ->
main_binary main_binary
in in
Lwt_result.bind_lwt_err (or_cleanup r) Lwt_result.bind_lwt_error (or_cleanup r)
(fun e -> (fun e ->
Db.rollback () Db.rollback ()
|> Lwt.map (fun r -> |> Lwt.map (fun r ->