avsm/ocaml-github — pull request #29 by gasche (2014-01-28 16:24:37+00:00)
Title: log response body in case of handler failure

In ran into an ocaml-github bug and not seeing the returned body made
the debugging more difficult -- well, I implemented this. You may want
to tweak this patch:

- it is not clear that the right thing to log is the body in full;
in my case (failure of a Json parse because of a
not-optional-by-mistake field), catching the error at the level of
the Json parsing, re-running the parser on the pretty-printed body,
and giving me the pretty-printed body would have make my life easier
(I did just that by hand to get a sensible line number in the error
message)
- implementation-wise I used two nested try_lwt as I defensively
assumed that CLB.string_of_body may fail as well (ah, let-try, how
we miss thee...)