@@ -311,9 +311,31 @@ impl fmt::Display for Error {
311
311
312
312
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
313
313
impl error:: Error for Error {
314
+ #[ allow( deprecated) ] // remove with UnexpectedEOF
314
315
fn description ( & self ) -> & str {
315
316
match self . repr {
316
- Repr :: Os ( ..) => "os error" ,
317
+ Repr :: Os ( ..) => match self . kind ( ) {
318
+ ErrorKind :: NotFound => "entity not found" ,
319
+ ErrorKind :: PermissionDenied => "permission denied" ,
320
+ ErrorKind :: ConnectionRefused => "connection refused" ,
321
+ ErrorKind :: ConnectionReset => "connection reset" ,
322
+ ErrorKind :: ConnectionAborted => "connection aborted" ,
323
+ ErrorKind :: NotConnected => "not connected" ,
324
+ ErrorKind :: AddrInUse => "address in use" ,
325
+ ErrorKind :: AddrNotAvailable => "address not available" ,
326
+ ErrorKind :: BrokenPipe => "broken pipe" ,
327
+ ErrorKind :: AlreadyExists => "entity already exists" ,
328
+ ErrorKind :: WouldBlock => "operation would block" ,
329
+ ErrorKind :: InvalidInput => "invalid input parameter" ,
330
+ ErrorKind :: InvalidData => "invalid data" ,
331
+ ErrorKind :: TimedOut => "timed out" ,
332
+ ErrorKind :: WriteZero => "write zero" ,
333
+ ErrorKind :: Interrupted => "operation interrupted" ,
334
+ ErrorKind :: Other => "other os error" ,
335
+ ErrorKind :: UnexpectedEOF => "unexpected end of file" ,
336
+ ErrorKind :: UnexpectedEof => "unexpected end of file" ,
337
+ ErrorKind :: __Nonexhaustive => unreachable ! ( )
338
+ } ,
317
339
Repr :: Custom ( ref c) => c. error . description ( ) ,
318
340
}
319
341
}
0 commit comments