You can also define a printer for the exception Unix_error, once and for all. let _ = Printexc.register_printer (fun exn -> match exn with Unix.Unix_error (error, s1, s2) -> Some (Printf.sprintf "Unix_error(%s, %s, %s)" (Unix.error_message error) s1 s2) | _ -> None) ;; It would probably be a good idea to include this code directly in the Unix module of the distribution, no ? --Fabrice On 03/08/2011 03:36 PM, Gerd Stolpmann wrote: > Am Dienstag, den 08.03.2011, 13:17 +1100 schrieb Arlen Cuss: > >> Exception Unix.Unix_error(31, "write", "") occurred >> Exception Unix.Unix_error(56, "write", "") occurred >> >> Both are occurring with the same reported backtrace; the former is Unix >> error EMLINK (too many links), the latter EISCONN (socket is connected); >> the strange thing is that *neither* of these errors should be throwable >> on a write() call! > > That's not quite correct. > > Error 31 is EPIPE. Error 56 is ECONNRESET. You can easily find out by > typing in the toploop: > > # (Obj.magic 31: Unix.error);; > - : Unix.error = Unix.EPIPE > # (Obj.magic 56: Unix.error);; > - : Unix.error = Unix.ECONNRESET > > The error numbers are not the official Unix ones, but something that > ocaml uses internally. > > Gerd > > >> >> I've ensured I'm correctly compiling with debug info, so I'm a bit lost. >> I can only assume a sprintf or similar call somewhere is going haywire. >> >> Anyone seen anything like this before? >> >> Best, >> Arlen >> >> > >