From 8495d469ee50ddca2af7b559eec189ac22102d84 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Wed, 6 Jul 2022 19:24:24 -0400 Subject: [PATCH] improve error reporting --- src/client/opentelemetry_client_ocurl.ml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/client/opentelemetry_client_ocurl.ml b/src/client/opentelemetry_client_ocurl.ml index 3117db24..358c7386 100644 --- a/src/client/opentelemetry_client_ocurl.ml +++ b/src/client/opentelemetry_client_ocurl.ml @@ -136,8 +136,15 @@ end = struct bt))) ) else ( let dec = Pbrt.Decoder.of_string (Buffer.contents buf_res) in - let status = Status.decode_status dec in - Error (`Status (code, status)) + try + let status = Status.decode_status dec in + Error (`Status (code, status)) + with e -> + let bt = Printexc.get_backtrace () in + Error + (`Failure + (spf "decoding of status failed with:\n%s\n%s" + (Printexc.to_string e) bt)) ) | exception Sys.Break -> Error `Sysbreak | exception Curl.CurlException (_, code, msg) ->