From 93a30366e15bdc30154ea22bcf179123e1809389 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Thu, 1 Aug 2024 10:51:35 -0400 Subject: [PATCH] better error message on IO failure --- src/core/IO.ml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/core/IO.ml b/src/core/IO.ml index 138668c4..4014e8fc 100644 --- a/src/core/IO.ml +++ b/src/core/IO.ml @@ -32,11 +32,13 @@ module Output = struct len := !len - n | exception Unix.Unix_error - ( ( Unix.EBADF | Unix.ENOTCONN | Unix.ESHUTDOWN - | Unix.ECONNRESET | Unix.EPIPE ), - _, + ( (( Unix.EBADF | Unix.ENOTCONN | Unix.ESHUTDOWN + | Unix.ECONNRESET | Unix.EPIPE ) as err), + fn, _ ) -> - failwith "write failed" + failwith + @@ Printf.sprintf "write failed in %s: %s" fn + (Unix.error_message err) | exception Unix.Unix_error ((Unix.EWOULDBLOCK | Unix.EAGAIN | Unix.EINTR), _, _) ->