mirror of
https://github.com/SpaceManiac/SpacemanDMM.git
synced 2025-12-23 05:36:47 +00:00
Rename DMError::set_cause to with_cause
This commit is contained in:
parent
289928a1b6
commit
240370c8b7
5 changed files with 5 additions and 5 deletions
|
|
@ -411,7 +411,7 @@ impl DMError {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn set_cause<E: error::Error + Send + Sync + 'static>(mut self, cause: E) -> DMError {
|
||||
pub fn with_cause<E: error::Error + Send + Sync + 'static>(mut self, cause: E) -> DMError {
|
||||
self.cause = Some(Box::new(cause));
|
||||
self
|
||||
}
|
||||
|
|
|
|||
|
|
@ -535,7 +535,7 @@ impl<I: Iterator<Item=io::Result<u8>>> Iterator for LocationTracker<I> {
|
|||
}
|
||||
Some(Ok(ch))
|
||||
}
|
||||
Some(Err(e)) => Some(Err(DMError::new(self.location, "i/o error").set_cause(e))),
|
||||
Some(Err(e)) => Some(Err(DMError::new(self.location, "i/o error").with_cause(e))),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -474,7 +474,7 @@ impl<'ctx, 'an, 'inp> Parser<'ctx, 'an, 'inp> {
|
|||
}
|
||||
Err(err) => self
|
||||
.error(format!("i/o error, expected one of: {}", expected))
|
||||
.set_cause(err),
|
||||
.with_cause(err),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -616,7 +616,7 @@ impl<'ctx> Preprocessor<'ctx> {
|
|||
// Attempt to open the file.
|
||||
let read = io::BufReader::new(File::open(&path).map_err(|e|
|
||||
DMError::new(self.last_input_loc, format!("failed to open file: #include {:?}", path))
|
||||
.set_cause(e))?);
|
||||
.with_cause(e))?);
|
||||
|
||||
// Get the path relative to the environment root, for easy lookup later.
|
||||
let register = path.strip_prefix(self.env_file.parent().unwrap()).unwrap_or(&path);
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ impl Map {
|
|||
grid: Array3::default((1, 1, 1)),
|
||||
};
|
||||
read::parse_map(&mut map, File::open(path).map_err(|e| {
|
||||
DMError::new(Location::default(), "i/o error").set_cause(e)
|
||||
DMError::new(Location::default(), "i/o error").with_cause(e)
|
||||
})?)?;
|
||||
Ok(map)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue