improve error reporting

This commit is contained in:
Simon Cruanes 2022-07-06 19:24:24 -04:00
parent 7eb75d66d6
commit 8495d469ee
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4

View file

@ -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) ->