From e21f0b7804848d8a0600b97f9cf0b5c01059e7ce Mon Sep 17 00:00:00 2001 From: Melody Horn Date: Mon, 5 Apr 2021 11:54:07 -0600 Subject: give context for errors in conditionals --- src/makefile/input.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/makefile/input.rs b/src/makefile/input.rs index 3707aef..316968f 100644 --- a/src/makefile/input.rs +++ b/src/makefile/input.rs @@ -331,11 +331,15 @@ impl<'a, 'parent, R: BufRead> MakefileReader<'a, 'parent, R> { Err(err) => return Some((line_number, Err(err))), }; if let Some(line) = cond_line { - let action = line.action( - self.conditional_stack.last(), - |name| self.macros.is_defined(name), - |t| self.expand_macros(t), - ); + let action = line + .action( + self.conditional_stack.last(), + |name| self.macros.is_defined(name), + |t| self.expand_macros(t), + ) + .wrap_err_with(|| { + format!("while applying conditional on line {}", line_number) + }); let action = match action { Ok(x) => x, Err(err) => return Some((line_number, Err(err))), -- cgit v1.2.3