Skip to content

Commit

Permalink
Prettier output of error message for invalid json
Browse files Browse the repository at this point in the history
  • Loading branch information
gpetiot committed Apr 2, 2024
1 parent b3dac5b commit baff235
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/contributions.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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 ->
Expand Down

0 comments on commit baff235

Please sign in to comment.