avoid Result.get_ok, as suggested by @reynir, to preserve the error

This commit is contained in:
Hannes Mehnert 2022-11-05 14:57:55 +01:00
parent 45657fdf32
commit cb37018a84

View file

@ -332,8 +332,7 @@ let of_octets ctx ~remote data =
Lwt.catch Lwt.catch
(fun () -> (fun () ->
init_store () >|= init_store () >|=
Result.map_error (Fmt.to_to_string Store.pp_error) >|= Result.fold ~ok:Fun.id ~error:(function `Msg msg -> failwith msg) >>= fun store ->
Result.get_ok >>= fun store ->
analyze store data >>= fun head -> analyze store data >>= fun head ->
let edn, branch = split_url remote in let edn, branch = split_url remote in
Lwt.return_ok { ctx ; edn ; branch ; store ; committed= None; in_closure= false; head; }) Lwt.return_ok { ctx ; edn ; branch ; store ; committed= None; in_closure= false; head; })