Capitalize all error messages (#144)
This commit is contained in:
parent
9c552fe8d0
commit
64e4905e49
@ -350,7 +350,7 @@ fn error() {
|
|||||||
"bar:\nhello:\nfoo: bar baaaaaaaz hello",
|
"bar:\nhello:\nfoo: bar baaaaaaaz hello",
|
||||||
255,
|
255,
|
||||||
"",
|
"",
|
||||||
"error: recipe `foo` has unknown dependency `baaaaaaaz`
|
"error: Recipe `foo` has unknown dependency `baaaaaaaz`
|
||||||
|
|
|
|
||||||
3 | foo: bar baaaaaaaz hello
|
3 | foo: bar baaaaaaaz hello
|
||||||
| ^^^^^^^^^
|
| ^^^^^^^^^
|
||||||
@ -387,7 +387,7 @@ fn backtick_code_assignment() {
|
|||||||
"b = a\na = `exit 100`\nbar:\n echo '{{`exit 200`}}'",
|
"b = a\na = `exit 100`\nbar:\n echo '{{`exit 200`}}'",
|
||||||
100,
|
100,
|
||||||
"",
|
"",
|
||||||
"error: backtick failed with exit code 100
|
"error: Backtick failed with exit code 100
|
||||||
|
|
|
|
||||||
2 | a = `exit 100`
|
2 | a = `exit 100`
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
@ -402,7 +402,7 @@ fn backtick_code_interpolation() {
|
|||||||
"b = a\na = `echo hello`\nbar:\n echo '{{`exit 200`}}'",
|
"b = a\na = `echo hello`\nbar:\n echo '{{`exit 200`}}'",
|
||||||
200,
|
200,
|
||||||
"",
|
"",
|
||||||
"error: backtick failed with exit code 200
|
"error: Backtick failed with exit code 200
|
||||||
|
|
|
|
||||||
4 | echo '{{`exit 200`}}'
|
4 | echo '{{`exit 200`}}'
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
@ -420,7 +420,7 @@ backtick-fail:
|
|||||||
",
|
",
|
||||||
1,
|
1,
|
||||||
"",
|
"",
|
||||||
"error: backtick failed with exit code 1
|
"error: Backtick failed with exit code 1
|
||||||
|
|
|
|
||||||
3 | echo {{`exit 1`}}
|
3 | echo {{`exit 1`}}
|
||||||
| ^^^^^^^^
|
| ^^^^^^^^
|
||||||
@ -438,7 +438,7 @@ backtick-fail:
|
|||||||
",
|
",
|
||||||
1,
|
1,
|
||||||
"",
|
"",
|
||||||
"error: backtick failed with exit code 1
|
"error: Backtick failed with exit code 1
|
||||||
|
|
|
|
||||||
3 | echo {{ `exit 1`}}
|
3 | echo {{ `exit 1`}}
|
||||||
| ^^^^^^^^
|
| ^^^^^^^^
|
||||||
@ -456,7 +456,7 @@ backtick-fail:
|
|||||||
",
|
",
|
||||||
1,
|
1,
|
||||||
"",
|
"",
|
||||||
"error: backtick failed with exit code 1
|
"error: Backtick failed with exit code 1
|
||||||
|
|
|
|
||||||
3 | echo {{ `exit 1`}}
|
3 | echo {{ `exit 1`}}
|
||||||
| ^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^
|
||||||
@ -474,7 +474,7 @@ backtick-fail:
|
|||||||
",
|
",
|
||||||
1,
|
1,
|
||||||
"",
|
"",
|
||||||
"error: backtick failed with exit code 1
|
"error: Backtick failed with exit code 1
|
||||||
|
|
|
|
||||||
3 | echo 😬{{`exit 1`}}
|
3 | echo 😬{{`exit 1`}}
|
||||||
| ^^^^^^^^
|
| ^^^^^^^^
|
||||||
@ -492,7 +492,7 @@ backtick-fail:
|
|||||||
",
|
",
|
||||||
1,
|
1,
|
||||||
"",
|
"",
|
||||||
"error: backtick failed with exit code 1
|
"error: Backtick failed with exit code 1
|
||||||
|
|
|
|
||||||
3 | echo 😬鎌鼬{{ `exit 1 # 😬鎌鼬`}} 😬鎌鼬
|
3 | echo 😬鎌鼬{{ `exit 1 # 😬鎌鼬`}} 😬鎌鼬
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
@ -507,7 +507,7 @@ fn backtick_code_long() {
|
|||||||
"\n\n\n\n\n\nb = a\na = `echo hello`\nbar:\n echo '{{`exit 200`}}'",
|
"\n\n\n\n\n\nb = a\na = `echo hello`\nbar:\n echo '{{`exit 200`}}'",
|
||||||
200,
|
200,
|
||||||
"",
|
"",
|
||||||
"error: backtick failed with exit code 200
|
"error: Backtick failed with exit code 200
|
||||||
|
|
|
|
||||||
10 | echo '{{`exit 200`}}'
|
10 | echo '{{`exit 200`}}'
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
@ -525,7 +525,7 @@ fn shebang_backtick_failure() {
|
|||||||
echo {{`exit 123`}}",
|
echo {{`exit 123`}}",
|
||||||
123,
|
123,
|
||||||
"",
|
"",
|
||||||
"error: backtick failed with exit code 123
|
"error: Backtick failed with exit code 123
|
||||||
|
|
|
|
||||||
4 | echo {{`exit 123`}}
|
4 | echo {{`exit 123`}}
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
@ -542,7 +542,7 @@ fn command_backtick_failure() {
|
|||||||
echo {{`exit 123`}}",
|
echo {{`exit 123`}}",
|
||||||
123,
|
123,
|
||||||
"hello\n",
|
"hello\n",
|
||||||
"echo hello\nerror: backtick failed with exit code 123
|
"echo hello\nerror: Backtick failed with exit code 123
|
||||||
|
|
|
|
||||||
3 | echo {{`exit 123`}}
|
3 | echo {{`exit 123`}}
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
@ -560,7 +560,7 @@ fn assignment_backtick_failure() {
|
|||||||
a = `exit 222`",
|
a = `exit 222`",
|
||||||
222,
|
222,
|
||||||
"",
|
"",
|
||||||
"error: backtick failed with exit code 222
|
"error: Backtick failed with exit code 222
|
||||||
|
|
|
|
||||||
4 | a = `exit 222`
|
4 | a = `exit 222`
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
@ -809,7 +809,7 @@ fn line_error_spacing() {
|
|||||||
"#,
|
"#,
|
||||||
255,
|
255,
|
||||||
"",
|
"",
|
||||||
"error: unknown start of token:
|
"error: Unknown start of token:
|
||||||
|
|
|
|
||||||
10 | ???
|
10 | ???
|
||||||
| ^
|
| ^
|
||||||
@ -1032,7 +1032,7 @@ fn color_always() {
|
|||||||
"b = a\na = `exit 100`\nbar:\n echo '{{`exit 200`}}'",
|
"b = a\na = `exit 100`\nbar:\n echo '{{`exit 200`}}'",
|
||||||
100,
|
100,
|
||||||
"",
|
"",
|
||||||
"\u{1b}[1;31merror:\u{1b}[0m \u{1b}[1mbacktick failed with exit code 100
|
"\u{1b}[1;31merror:\u{1b}[0m \u{1b}[1mBacktick failed with exit code 100
|
||||||
\u{1b}[0m |\n2 | a = `exit 100`\n | \u{1b}[1;31m^^^^^^^^^^\u{1b}[0m\n",
|
\u{1b}[0m |\n2 | a = `exit 100`\n | \u{1b}[1;31m^^^^^^^^^^\u{1b}[0m\n",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -1044,7 +1044,7 @@ fn color_never() {
|
|||||||
"b = a\na = `exit 100`\nbar:\n echo '{{`exit 200`}}'",
|
"b = a\na = `exit 100`\nbar:\n echo '{{`exit 200`}}'",
|
||||||
100,
|
100,
|
||||||
"",
|
"",
|
||||||
"error: backtick failed with exit code 100
|
"error: Backtick failed with exit code 100
|
||||||
|
|
|
|
||||||
2 | a = `exit 100`
|
2 | a = `exit 100`
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
@ -1059,7 +1059,7 @@ fn color_auto() {
|
|||||||
"b = a\na = `exit 100`\nbar:\n echo '{{`exit 200`}}'",
|
"b = a\na = `exit 100`\nbar:\n echo '{{`exit 200`}}'",
|
||||||
100,
|
100,
|
||||||
"",
|
"",
|
||||||
"error: backtick failed with exit code 100
|
"error: Backtick failed with exit code 100
|
||||||
|
|
|
|
||||||
2 | a = `exit 100`
|
2 | a = `exit 100`
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
@ -1107,7 +1107,7 @@ fn required_after_default() {
|
|||||||
"bar:\nhello baz arg='foo' bar:",
|
"bar:\nhello baz arg='foo' bar:",
|
||||||
255,
|
255,
|
||||||
"",
|
"",
|
||||||
"error: non-default parameter `bar` follows default parameter
|
"error: Non-default parameter `bar` follows default parameter
|
||||||
|
|
|
|
||||||
2 | hello baz arg='foo' bar:
|
2 | hello baz arg='foo' bar:
|
||||||
| ^^^
|
| ^^^
|
||||||
@ -1381,7 +1381,7 @@ fn long_circular_recipe_dependency() {
|
|||||||
"a: b\nb: c\nc: d\nd: a",
|
"a: b\nb: c\nc: d\nd: a",
|
||||||
255,
|
255,
|
||||||
"",
|
"",
|
||||||
"error: recipe `d` has circular dependency `a -> b -> c -> d -> a`
|
"error: Recipe `d` has circular dependency `a -> b -> c -> d -> a`
|
||||||
|
|
|
|
||||||
4 | d: a
|
4 | d: a
|
||||||
| ^
|
| ^
|
||||||
@ -1424,7 +1424,7 @@ a:
|
|||||||
",
|
",
|
||||||
255,
|
255,
|
||||||
"",
|
"",
|
||||||
"error: variable `foo` not defined
|
"error: Variable `foo` not defined
|
||||||
|
|
|
|
||||||
7 | echo '{{foo}}'
|
7 | echo '{{foo}}'
|
||||||
| ^^^
|
| ^^^
|
||||||
@ -1446,7 +1446,7 @@ a:
|
|||||||
",
|
",
|
||||||
255,
|
255,
|
||||||
"",
|
"",
|
||||||
"error: variable `bar` not defined
|
"error: Variable `bar` not defined
|
||||||
|
|
|
|
||||||
4 | whatever' + bar
|
4 | whatever' + bar
|
||||||
| ^^^
|
| ^^^
|
||||||
@ -1486,7 +1486,7 @@ a:
|
|||||||
"#,
|
"#,
|
||||||
255,
|
255,
|
||||||
"",
|
"",
|
||||||
"error: variable `b` not defined
|
"error: Variable `b` not defined
|
||||||
|
|
|
|
||||||
6 | echo {{b}}
|
6 | echo {{b}}
|
||||||
| ^
|
| ^
|
||||||
@ -1503,7 +1503,7 @@ a b=':
|
|||||||
",
|
",
|
||||||
255,
|
255,
|
||||||
"",
|
"",
|
||||||
"error: unterminated string
|
"error: Unterminated string
|
||||||
|
|
|
|
||||||
2 | a b=':
|
2 | a b=':
|
||||||
| ^
|
| ^
|
||||||
@ -1520,7 +1520,7 @@ a b=":
|
|||||||
"#,
|
"#,
|
||||||
255,
|
255,
|
||||||
"",
|
"",
|
||||||
r#"error: unterminated string
|
r#"error: Unterminated string
|
||||||
|
|
|
|
||||||
2 | a b=":
|
2 | a b=":
|
||||||
| ^
|
| ^
|
||||||
|
60
src/lib.rs
60
src/lib.rs
@ -1052,18 +1052,18 @@ impl<'a> Display for CompileError<'a> {
|
|||||||
match self.kind {
|
match self.kind {
|
||||||
CircularRecipeDependency{recipe, ref circle} => {
|
CircularRecipeDependency{recipe, ref circle} => {
|
||||||
if circle.len() == 2 {
|
if circle.len() == 2 {
|
||||||
write!(f, "recipe `{}` depends on itself", recipe)?;
|
write!(f, "Recipe `{}` depends on itself", recipe)?;
|
||||||
} else {
|
} else {
|
||||||
writeln!(f, "recipe `{}` has circular dependency `{}`",
|
writeln!(f, "Recipe `{}` has circular dependency `{}`",
|
||||||
recipe, circle.join(" -> "))?;
|
recipe, circle.join(" -> "))?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CircularVariableDependency{variable, ref circle} => {
|
CircularVariableDependency{variable, ref circle} => {
|
||||||
if circle.len() == 2 {
|
if circle.len() == 2 {
|
||||||
writeln!(f, "variable `{}` depends on its own value: `{}`",
|
writeln!(f, "Variable `{}` depends on its own value: `{}`",
|
||||||
variable, circle.join(" -> "))?;
|
variable, circle.join(" -> "))?;
|
||||||
} else {
|
} else {
|
||||||
writeln!(f, "variable `{}` depends on its own value: `{}`",
|
writeln!(f, "Variable `{}` depends on its own value: `{}`",
|
||||||
variable, circle.join(" -> "))?;
|
variable, circle.join(" -> "))?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1072,67 +1072,67 @@ impl<'a> Display for CompileError<'a> {
|
|||||||
character.escape_default().collect::<String>())?;
|
character.escape_default().collect::<String>())?;
|
||||||
}
|
}
|
||||||
DuplicateParameter{recipe, parameter} => {
|
DuplicateParameter{recipe, parameter} => {
|
||||||
writeln!(f, "recipe `{}` has duplicate parameter `{}`", recipe, parameter)?;
|
writeln!(f, "Recipe `{}` has duplicate parameter `{}`", recipe, parameter)?;
|
||||||
}
|
}
|
||||||
DuplicateVariable{variable} => {
|
DuplicateVariable{variable} => {
|
||||||
writeln!(f, "variable `{}` is has multiple definitions", variable)?;
|
writeln!(f, "Variable `{}` is has multiple definitions", variable)?;
|
||||||
}
|
}
|
||||||
UnexpectedToken{ref expected, found} => {
|
UnexpectedToken{ref expected, found} => {
|
||||||
writeln!(f, "expected {} but found {}", Or(expected), found)?;
|
writeln!(f, "Expected {} but found {}", Or(expected), found)?;
|
||||||
}
|
}
|
||||||
DuplicateDependency{recipe, dependency} => {
|
DuplicateDependency{recipe, dependency} => {
|
||||||
writeln!(f, "recipe `{}` has duplicate dependency `{}`", recipe, dependency)?;
|
writeln!(f, "Recipe `{}` has duplicate dependency `{}`", recipe, dependency)?;
|
||||||
}
|
}
|
||||||
DuplicateRecipe{recipe, first} => {
|
DuplicateRecipe{recipe, first} => {
|
||||||
writeln!(f, "recipe `{}` first defined on line {} is redefined on line {}",
|
writeln!(f, "Recipe `{}` first defined on line {} is redefined on line {}",
|
||||||
recipe, first, self.line)?;
|
recipe, first, self.line)?;
|
||||||
}
|
}
|
||||||
DependencyHasParameters{recipe, dependency} => {
|
DependencyHasParameters{recipe, dependency} => {
|
||||||
writeln!(f, "recipe `{}` depends on `{}` which requires arguments. \
|
writeln!(f, "Recipe `{}` depends on `{}` which requires arguments. \
|
||||||
dependencies may not require arguments", recipe, dependency)?;
|
dependencies may not require arguments", recipe, dependency)?;
|
||||||
}
|
}
|
||||||
ParameterShadowsVariable{parameter} => {
|
ParameterShadowsVariable{parameter} => {
|
||||||
writeln!(f, "parameter `{}` shadows variable of the same name", parameter)?;
|
writeln!(f, "Parameter `{}` shadows variable of the same name", parameter)?;
|
||||||
}
|
}
|
||||||
RequiredParameterFollowsDefaultParameter{parameter} => {
|
RequiredParameterFollowsDefaultParameter{parameter} => {
|
||||||
writeln!(f, "non-default parameter `{}` follows default parameter", parameter)?;
|
writeln!(f, "Non-default parameter `{}` follows default parameter", parameter)?;
|
||||||
}
|
}
|
||||||
ParameterFollowsVariadicParameter{parameter} => {
|
ParameterFollowsVariadicParameter{parameter} => {
|
||||||
writeln!(f, "parameter `{}` follows a varidic parameter", parameter)?;
|
writeln!(f, "Parameter `{}` follows a varidic parameter", parameter)?;
|
||||||
}
|
}
|
||||||
MixedLeadingWhitespace{whitespace} => {
|
MixedLeadingWhitespace{whitespace} => {
|
||||||
writeln!(f,
|
writeln!(f,
|
||||||
"found a mix of tabs and spaces in leading whitespace: `{}`\n\
|
"Found a mix of tabs and spaces in leading whitespace: `{}`\n\
|
||||||
leading whitespace may consist of tabs or spaces, but not both",
|
leading whitespace may consist of tabs or spaces, but not both",
|
||||||
show_whitespace(whitespace)
|
show_whitespace(whitespace)
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
ExtraLeadingWhitespace => {
|
ExtraLeadingWhitespace => {
|
||||||
writeln!(f, "recipe line has extra leading whitespace")?;
|
writeln!(f, "Recipe line has extra leading whitespace")?;
|
||||||
}
|
}
|
||||||
InconsistentLeadingWhitespace{expected, found} => {
|
InconsistentLeadingWhitespace{expected, found} => {
|
||||||
writeln!(f,
|
writeln!(f,
|
||||||
"inconsistant leading whitespace: recipe started with `{}` but found line with `{}`:",
|
"Inconsistant leading whitespace: recipe started with `{}` but found line with `{}`:",
|
||||||
show_whitespace(expected), show_whitespace(found)
|
show_whitespace(expected), show_whitespace(found)
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
OuterShebang => {
|
OuterShebang => {
|
||||||
writeln!(f, "a shebang `#!` is reserved syntax outside of recipes")?;
|
writeln!(f, "Shebang `#!` is reserved syntax outside of recipes")?;
|
||||||
}
|
}
|
||||||
UnknownDependency{recipe, unknown} => {
|
UnknownDependency{recipe, unknown} => {
|
||||||
writeln!(f, "recipe `{}` has unknown dependency `{}`", recipe, unknown)?;
|
writeln!(f, "Recipe `{}` has unknown dependency `{}`", recipe, unknown)?;
|
||||||
}
|
}
|
||||||
UndefinedVariable{variable} => {
|
UndefinedVariable{variable} => {
|
||||||
writeln!(f, "variable `{}` not defined", variable)?;
|
writeln!(f, "Variable `{}` not defined", variable)?;
|
||||||
}
|
}
|
||||||
UnknownStartOfToken => {
|
UnknownStartOfToken => {
|
||||||
writeln!(f, "unknown start of token:")?;
|
writeln!(f, "Unknown start of token:")?;
|
||||||
}
|
}
|
||||||
UnterminatedString => {
|
UnterminatedString => {
|
||||||
writeln!(f, "unterminated string")?;
|
writeln!(f, "Unterminated string")?;
|
||||||
}
|
}
|
||||||
InternalError{ref message} => {
|
InternalError{ref message} => {
|
||||||
writeln!(f, "internal error, this may indicate a bug in just: {}\n\
|
writeln!(f, "Internal error, this may indicate a bug in just: {}\n\
|
||||||
consider filing an issue: https://github.com/casey/just/issues/new",
|
consider filing an issue: https://github.com/casey/just/issues/new",
|
||||||
message)?;
|
message)?;
|
||||||
}
|
}
|
||||||
@ -1397,35 +1397,35 @@ impl<'a> Display for RunError<'a> {
|
|||||||
to create a temporary directory or write a file to that directory`:\n{}",
|
to create a temporary directory or write a file to that directory`:\n{}",
|
||||||
recipe, io_error)?,
|
recipe, io_error)?,
|
||||||
BacktickCode{code, ref token} => {
|
BacktickCode{code, ref token} => {
|
||||||
write!(f, "backtick failed with exit code {}\n", code)?;
|
write!(f, "Backtick failed with exit code {}\n", code)?;
|
||||||
error_token = Some(token);
|
error_token = Some(token);
|
||||||
}
|
}
|
||||||
BacktickSignal{ref token, signal} => {
|
BacktickSignal{ref token, signal} => {
|
||||||
write!(f, "backtick was terminated by signal {}", signal)?;
|
write!(f, "Backtick was terminated by signal {}", signal)?;
|
||||||
error_token = Some(token);
|
error_token = Some(token);
|
||||||
}
|
}
|
||||||
BacktickUnknownFailure{ref token} => {
|
BacktickUnknownFailure{ref token} => {
|
||||||
write!(f, "backtick failed for an uknown reason")?;
|
write!(f, "Backtick failed for an uknown reason")?;
|
||||||
error_token = Some(token);
|
error_token = Some(token);
|
||||||
}
|
}
|
||||||
BacktickIoError{ref token, ref io_error} => {
|
BacktickIoError{ref token, ref io_error} => {
|
||||||
match io_error.kind() {
|
match io_error.kind() {
|
||||||
io::ErrorKind::NotFound => write!(
|
io::ErrorKind::NotFound => write!(
|
||||||
f, "backtick could not be run because just could not find `sh` the command:\n{}",
|
f, "Backtick could not be run because just could not find `sh` the command:\n{}",
|
||||||
io_error),
|
io_error),
|
||||||
io::ErrorKind::PermissionDenied => write!(
|
io::ErrorKind::PermissionDenied => write!(
|
||||||
f, "backtick could not be run because just could not run `sh`:\n{}", io_error),
|
f, "Backtick could not be run because just could not run `sh`:\n{}", io_error),
|
||||||
_ => write!(f, "backtick could not be run because of an IO \
|
_ => write!(f, "Backtick could not be run because of an IO \
|
||||||
error while launching `sh`:\n{}", io_error),
|
error while launching `sh`:\n{}", io_error),
|
||||||
}?;
|
}?;
|
||||||
error_token = Some(token);
|
error_token = Some(token);
|
||||||
}
|
}
|
||||||
BacktickUtf8Error{ref token, ref utf8_error} => {
|
BacktickUtf8Error{ref token, ref utf8_error} => {
|
||||||
write!(f, "backtick succeeded but stdout was not utf8: {}", utf8_error)?;
|
write!(f, "Backtick succeeded but stdout was not utf8: {}", utf8_error)?;
|
||||||
error_token = Some(token);
|
error_token = Some(token);
|
||||||
}
|
}
|
||||||
InternalError{ref message} => {
|
InternalError{ref message} => {
|
||||||
write!(f, "internal error, this may indicate a bug in just: {} \
|
write!(f, "Internal error, this may indicate a bug in just: {} \
|
||||||
consider filing an issue: https://github.com/casey/just/issues/new",
|
consider filing an issue: https://github.com/casey/just/issues/new",
|
||||||
message)?;
|
message)?;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user