From 01dd7d152a40915a9072b1c617f5a673f33c9962 Mon Sep 17 00:00:00 2001 From: Pietro Date: Mon, 5 Mar 2018 14:18:01 +0100 Subject: [PATCH] Client: better error messages for unwrapped JSON objects. --- src/bin_client/client_rpc_commands.ml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/bin_client/client_rpc_commands.ml b/src/bin_client/client_rpc_commands.ml index 6fbe044fb..74ad96ccb 100644 --- a/src/bin_client/client_rpc_commands.ml +++ b/src/bin_client/client_rpc_commands.ml @@ -395,6 +395,10 @@ let call raw_url (cctxt : #Client_context.full) = let call_with_json raw_url json (cctxt: #Client_context.full) = let uri = Uri.of_string raw_url in match Data_encoding.Json.from_string json with + | exception Assert_failure _ -> + (* Ref : https://github.com/mirage/ezjsonm/issues/31 *) + cctxt#error + "Failed to parse the provided json: unwrapped JSON value.\n%!" | Error err -> cctxt#error "Failed to parse the provided json: %s\n%!"