From a44441a44a5a0420424482346ae82840ec7ebff4 Mon Sep 17 00:00:00 2001 From: "Guillaume \"Liam\" Petiot" Date: Tue, 2 Apr 2024 18:33:34 +0100 Subject: [PATCH] Prettier output of error message for invalid json (#35) --- lib/contributions.ml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/contributions.ml b/lib/contributions.ml index 29d0c4d..ece4fb2 100644 --- a/lib/contributions.ml +++ b/lib/contributions.ml @@ -133,8 +133,9 @@ let of_json ~period:(from, to_) ~user json = let* json = match Json.t_of_yojson json with | x -> Ok x - | exception Ppx_yojson_conv_lib.Yojson_conv.Of_yojson_error (exn, _) -> - Error (`Msg (Printexc.to_string exn)) + | exception Ppx_yojson_conv_lib.Yojson_conv.Of_yojson_error (Failure e, _) + -> + Error (`Msg e) in match json.data with | Some data ->