Skip to content

Commit

Permalink
Use OsError when File::metadata fails (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
milesgranger authored Mar 31, 2021
1 parent f90565c commit cb0dd0e
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
1 change: 0 additions & 1 deletion src/exceptions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ use pyo3::exceptions::PyException;

create_exception!(cramjam, CompressionError, PyException);
create_exception!(cramjam, DecompressionError, PyException);
create_exception!(cramjam, CramjamError, PyException);
3 changes: 1 addition & 2 deletions src/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use std::fs::{File, OpenOptions};
use std::io::{copy, Cursor, Read, Seek, SeekFrom, Write};

use crate::BytesType;
use crate::exceptions::CramjamError;
use numpy::PyArray1;
use pyo3::class::buffer::PyBufferProtocol;
use pyo3::prelude::*;
Expand Down Expand Up @@ -341,7 +340,7 @@ impl RustyFile {
let meta = self
.inner
.metadata()
.map_err(|e| CramjamError::new_err(e.to_string()))?;
.map_err(|e| pyo3::exceptions::PyOSError::new_err(e.to_string()))?;
Ok(meta.len() as usize)
}
}
Expand Down

0 comments on commit cb0dd0e

Please sign in to comment.