aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMelody Horn <melody@boringcactus.com>2021-04-05 11:54:07 -0600
committerMelody Horn <melody@boringcactus.com>2021-04-05 11:54:07 -0600
commite21f0b7804848d8a0600b97f9cf0b5c01059e7ce (patch)
tree71da3e6bd4917bff609f31f3c662745ad48b44a2
parente8863d5454cf1b2844a55636e1b7a00e0977d998 (diff)
downloadmakers-e21f0b7804848d8a0600b97f9cf0b5c01059e7ce.tar.gz
makers-e21f0b7804848d8a0600b97f9cf0b5c01059e7ce.zip
give context for errors in conditionals
-rw-r--r--src/makefile/input.rs14
1 files changed, 9 insertions, 5 deletions
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))),