I'm reading Real World Ocaml and i have problems understanding how to present detailed yet uncluttered error messages to the user. I really like the idea of error-aware return types but getting the desired result out of Core seems to be impossible. I am probably doing something wrong. The examples in the book that i had seen so far look similar to the following one in a sense that they detect an exception and report "unexpected failure" or some such.
(* part 1 *)
(* Execute the DuckDuckGo search *)
let get_definition ~server word =
try_with (fun () ->
Cohttp_async.Client.get (query_uri ~server word)