From cb37018a8490ceb76be5a95e186eec17d0ce6ce5 Mon Sep 17 00:00:00 2001 From: Hannes Mehnert Date: Sat, 5 Nov 2022 14:57:55 +0100 Subject: [PATCH] avoid Result.get_ok, as suggested by @reynir, to preserve the error --- src/git_kv.ml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/git_kv.ml b/src/git_kv.ml index 82618df..1123f25 100644 --- a/src/git_kv.ml +++ b/src/git_kv.ml @@ -332,8 +332,7 @@ let of_octets ctx ~remote data = Lwt.catch (fun () -> init_store () >|= - Result.map_error (Fmt.to_to_string Store.pp_error) >|= - Result.get_ok >>= fun store -> + Result.fold ~ok:Fun.id ~error:(function `Msg msg -> failwith msg) >>= fun store -> analyze store data >>= fun head -> let edn, branch = split_url remote in Lwt.return_ok { ctx ; edn ; branch ; store ; committed= None; in_closure= false; head; })