Include line in all error messages (#51)
I had previously not included the line for some error messages, but I don't think that I had a good reason why, and they look pretty good, so adding them back for consistency.
This commit is contained in:
parent
59136a1145
commit
74fa6d4962
13
src/lib.rs
13
src/lib.rs
@ -774,13 +774,15 @@ impl<'a> Display for Error<'a> {
|
|||||||
if circle.len() == 2 {
|
if circle.len() == 2 {
|
||||||
try!(write!(f, "recipe `{}` depends on itself", recipe));
|
try!(write!(f, "recipe `{}` depends on itself", recipe));
|
||||||
} else {
|
} else {
|
||||||
try!(write!(f, "recipe `{}` has circular dependency `{}`", recipe, circle.join(" -> ")));
|
try!(writeln!(f, "recipe `{}` has circular dependency `{}`", recipe, circle.join(" -> ")));
|
||||||
}
|
}
|
||||||
return Ok(());
|
|
||||||
}
|
}
|
||||||
ErrorKind::CircularVariableDependency{variable, ref circle} => {
|
ErrorKind::CircularVariableDependency{variable, ref circle} => {
|
||||||
try!(write!(f, "assignment to `{}` has circular dependency: `{}`", variable, circle.join(" -> ")));
|
if circle.len() == 2 {
|
||||||
return Ok(());
|
try!(writeln!(f, "variable `{}` depends on its own value: `{}`", variable, circle.join(" -> ")));
|
||||||
|
} else {
|
||||||
|
try!(writeln!(f, "variable `{}` depends on its own value: `{}`", variable, circle.join(" -> ")));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ErrorKind::InvalidEscapeSequence{character} => {
|
ErrorKind::InvalidEscapeSequence{character} => {
|
||||||
try!(writeln!(f, "`\\{}` is not a valid escape sequence", character.escape_default().collect::<String>()));
|
try!(writeln!(f, "`\\{}` is not a valid escape sequence", character.escape_default().collect::<String>()));
|
||||||
@ -798,9 +800,8 @@ impl<'a> Display for Error<'a> {
|
|||||||
try!(writeln!(f, "recipe `{}` has duplicate dependency `{}`", recipe, dependency));
|
try!(writeln!(f, "recipe `{}` has duplicate dependency `{}`", recipe, dependency));
|
||||||
}
|
}
|
||||||
ErrorKind::DuplicateRecipe{recipe, first} => {
|
ErrorKind::DuplicateRecipe{recipe, first} => {
|
||||||
try!(write!(f, "recipe `{}` first defined on line {} is redefined on line {}",
|
try!(writeln!(f, "recipe `{}` first defined on line {} is redefined on line {}",
|
||||||
recipe, first, self.line));
|
recipe, first, self.line));
|
||||||
return Ok(());
|
|
||||||
}
|
}
|
||||||
ErrorKind::DependencyHasParameters{recipe, dependency} => {
|
ErrorKind::DependencyHasParameters{recipe, dependency} => {
|
||||||
try!(writeln!(f, "recipe `{}` depends on `{}` which requires arguments. dependencies may not require arguments", recipe, dependency));
|
try!(writeln!(f, "recipe `{}` depends on `{}` which requires arguments. dependencies may not require arguments", recipe, dependency));
|
||||||
|
Loading…
Reference in New Issue
Block a user