@@ -105,6 +105,13 @@ fn translate_error(errno: i32, detail: bool) -> IoError {
105
105
libc:: WSAEADDRINUSE => ( io:: ConnectionRefused , "address in use" ) ,
106
106
libc:: ERROR_BROKEN_PIPE => ( io:: EndOfFile , "the pipe has ended" ) ,
107
107
108
+ // libuv maps this error code to EISDIR. we do too. if it is found
109
+ // to be incorrect, we can add in some more machinery to only
110
+ // return this message when ERROR_INVALID_FUNCTION after certain
111
+ // win32 calls.
112
+ libc:: ERROR_INVALID_FUNCTION => ( io:: InvalidInput ,
113
+ "illegal operation on a directory" ) ,
114
+
108
115
x => {
109
116
debug ! ( "ignoring {}: {}" , x, os:: last_os_error( ) ) ;
110
117
( io:: OtherIoError , "unknown error" )
@@ -127,6 +134,7 @@ fn translate_error(errno: i32, detail: bool) -> IoError {
127
134
libc:: EADDRNOTAVAIL => ( io:: ConnectionRefused , "address not available" ) ,
128
135
libc:: EADDRINUSE => ( io:: ConnectionRefused , "address in use" ) ,
129
136
libc:: ENOENT => ( io:: FileNotFound , "no such file or directory" ) ,
137
+ libc:: EISDIR => ( io:: InvalidInput , "illegal operation on a directory" ) ,
130
138
131
139
// These two constants can have the same value on some systems, but
132
140
// different values on others, so we can't use a match clause
0 commit comments