better error message on IO failure

This commit is contained in:
Simon Cruanes 2024-08-01 10:51:35 -04:00
parent 5130653068
commit 93a30366e1
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4

View file

@ -32,11 +32,13 @@ module Output = struct
len := !len - n len := !len - n
| exception | exception
Unix.Unix_error Unix.Unix_error
( ( Unix.EBADF | Unix.ENOTCONN | Unix.ESHUTDOWN ( (( Unix.EBADF | Unix.ENOTCONN | Unix.ESHUTDOWN
| Unix.ECONNRESET | Unix.EPIPE ), | Unix.ECONNRESET | Unix.EPIPE ) as err),
_, fn,
_ ) -> _ ) ->
failwith "write failed" failwith
@@ Printf.sprintf "write failed in %s: %s" fn
(Unix.error_message err)
| exception | exception
Unix.Unix_error Unix.Unix_error
((Unix.EWOULDBLOCK | Unix.EAGAIN | Unix.EINTR), _, _) -> ((Unix.EWOULDBLOCK | Unix.EAGAIN | Unix.EINTR), _, _) ->