Skip to content

Commit

Permalink
Merge pull request #1840 from hongquan/feature/more-specific-oserror
Browse files Browse the repository at this point in the history
Convert io::Error to more specific Python OSError
  • Loading branch information
davidhewitt committed Aug 28, 2021
2 parents a6d6367 + b721a45 commit 3fa97f9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/err/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ impl std::convert::From<io::Error> for PyErr {
io::ErrorKind::ConnectionReset => exceptions::PyConnectionResetError::new_err(err),
io::ErrorKind::Interrupted => exceptions::PyInterruptedError::new_err(err),
io::ErrorKind::NotFound => exceptions::PyFileNotFoundError::new_err(err),
io::ErrorKind::PermissionDenied => exceptions::PyPermissionError::new_err(err),
io::ErrorKind::AlreadyExists => exceptions::PyFileExistsError::new_err(err),
io::ErrorKind::WouldBlock => exceptions::PyBlockingIOError::new_err(err),
io::ErrorKind::TimedOut => exceptions::PyTimeoutError::new_err(err),
_ => exceptions::PyOSError::new_err(err),
Expand Down Expand Up @@ -108,6 +110,8 @@ mod tests {
check_err(io::ErrorKind::ConnectionReset, "ConnectionResetError");
check_err(io::ErrorKind::Interrupted, "InterruptedError");
check_err(io::ErrorKind::NotFound, "FileNotFoundError");
check_err(io::ErrorKind::PermissionDenied, "PermissionError");
check_err(io::ErrorKind::AlreadyExists, "FileExistsError");
check_err(io::ErrorKind::WouldBlock, "BlockingIOError");
check_err(io::ErrorKind::TimedOut, "TimeoutError");
}
Expand Down

0 comments on commit 3fa97f9

Please sign in to comment.