mirror of
https://github.com/dnlbauer/xdrfile.git
synced 2026-09-11 06:35:30 +00:00
Clarified error message when read_num_atoms() fails during read()
This commit is contained in:
@@ -202,7 +202,9 @@ impl Trajectory for XTCTrajectory {
|
||||
fn read(&mut self, frame: &mut Frame) -> Result<()> {
|
||||
let mut step: i32 = 0;
|
||||
|
||||
let num_atoms = self.get_num_atoms()? as usize;
|
||||
let num_atoms = self
|
||||
.get_num_atoms()
|
||||
.map_err(|e| Error::CouldNotCheckNAtoms(Box::new(e)))? as usize;
|
||||
if num_atoms != frame.coords.len() {
|
||||
return Err(Error::from((&*frame, num_atoms)));
|
||||
}
|
||||
@@ -303,7 +305,9 @@ impl Trajectory for TRRTrajectory {
|
||||
let mut step: i32 = 0;
|
||||
let mut lambda: f32 = 0.0;
|
||||
|
||||
let num_atoms = self.get_num_atoms()? as usize;
|
||||
let num_atoms = self
|
||||
.get_num_atoms()
|
||||
.map_err(|e| Error::CouldNotCheckNAtoms(Box::new(e)))? as usize;
|
||||
if num_atoms != frame.coords.len() {
|
||||
return Err(Error::from((&*frame, num_atoms)));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user