Generalize InvalidRatedEase error for rated and prop:rated

This commit is contained in:
Henrik Giesel 2021-01-17 23:55:05 +01:00
parent 2b45ef22a5
commit bdc6494c79
2 changed files with 4 additions and 4 deletions

View File

@ -17,7 +17,7 @@ search-invalid-argument = `{ $term }` was given an invalid argument '`{ $argumen
search-invalid-flag = `flag:` must be followed by a valid flag number: `1` (red), `2` (orange), `3` (green), `4` (blue) or `0` (no flag).
search-invalid-followed-by-positive-days = `{ $term }` must be followed by a positive number of days.
search-invalid-rated-days = `rated:` must be followed by a positive number of days.
search-invalid-rated-ease = `rated:{ $val }:` must be followed by `1` (again), `2` (hard), `3` (good) or `4` (easy).
search-invalid-rated-ease = `{ $val }:` must be followed by `1` (again), `2` (hard), `3` (good) or `4` (easy).
search-invalid-prop-operator = `prop:{ $val }` must be followed by one of the comparison operators: `=`, `!=`, `<`, `>`, `<=` or `>=`.
search-invalid-prop-float = `prop:{ $val }` must be followed by a decimal number.
search-invalid-prop-integer = `prop:{ $val }` must be followed by a whole number.

View File

@ -423,7 +423,7 @@ fn parse_prop(s: &str) -> ParseResult<SearchNode> {
} else {
return Err(parse_failure(
s,
FailKind::InvalidPropInteger(format!("{}{}", prop, operator)),
FailKind::InvalidRatedEase(format!("prop:{}{}{}", prop, operator, days.to_string())),
));
}
} else {
@ -498,13 +498,13 @@ fn parse_rated(s: &str) -> ParseResult<SearchNode> {
} else {
return Err(parse_failure(
s,
FailKind::InvalidRatedEase(days.to_string()),
FailKind::InvalidRatedEase(format!("rated:{}", days.to_string())),
));
}
} else {
return Err(parse_failure(
s,
FailKind::InvalidRatedEase(days.to_string()),
FailKind::InvalidRatedEase(format!("rated:{}", days.to_string())),
));
}
} else {