diff --git a/src/dreammaker/error.rs b/src/dreammaker/error.rs index 9c8e35e2..28bd8586 100644 --- a/src/dreammaker/error.rs +++ b/src/dreammaker/error.rs @@ -411,7 +411,7 @@ impl DMError { } } - pub fn set_cause(mut self, cause: E) -> DMError { + pub fn with_cause(mut self, cause: E) -> DMError { self.cause = Some(Box::new(cause)); self } diff --git a/src/dreammaker/lexer.rs b/src/dreammaker/lexer.rs index 19c10fd0..c28cff52 100644 --- a/src/dreammaker/lexer.rs +++ b/src/dreammaker/lexer.rs @@ -535,7 +535,7 @@ impl>> Iterator for LocationTracker { } 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))), } } } diff --git a/src/dreammaker/parser.rs b/src/dreammaker/parser.rs index 1c4c6c51..3ac2ebaa 100644 --- a/src/dreammaker/parser.rs +++ b/src/dreammaker/parser.rs @@ -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), } } diff --git a/src/dreammaker/preprocessor.rs b/src/dreammaker/preprocessor.rs index 83a1ac2c..b51bfddb 100644 --- a/src/dreammaker/preprocessor.rs +++ b/src/dreammaker/preprocessor.rs @@ -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); diff --git a/src/tools/dmm.rs b/src/tools/dmm.rs index 508afcd7..18ea6693 100644 --- a/src/tools/dmm.rs +++ b/src/tools/dmm.rs @@ -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) }