From ad55d4888e6dfc513a2d41e734dd07ffd5c4b944 Mon Sep 17 00:00:00 2001 From: Hannes Mehnert Date: Sat, 5 Nov 2022 17:01:33 +0100 Subject: [PATCH] mgit: print error if change_and_push failed (as suggested by @reynir) --- app/mgit.ml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/mgit.ml b/app/mgit.ml index 2c3c429..4e21606 100644 --- a/app/mgit.ml +++ b/app/mgit.ml @@ -140,7 +140,8 @@ let repl store fd_in = | [ "quit"; ] -> Lwt.return () | [ "fold"; ] -> Store.change_and_push store0 (fun store1 -> go store1) - >>= fun _ -> go store0 + >|= Result.fold ~ok:Fun.id ~error:(function `Msg msg -> Fmt.epr "%s.\n%!" msg) + >>= fun () -> go store0 | [ "save"; filename ] -> save store0 filename >|= ignore >>= fun _ -> if is_a_tty then Fmt.pr "\n%!" ; go store0