mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 22:42:25 -04:00
Merge pull request #1168 from RumovZ/fix-regex-err
Fix regex error formatting
This commit is contained in:
commit
958823fd6d
2 changed files with 1 additions and 4 deletions
|
@ -75,6 +75,7 @@ impl AnkiError {
|
||||||
}
|
}
|
||||||
AnkiError::ParseNumError => tr.errors_parse_number_fail().into(),
|
AnkiError::ParseNumError => tr.errors_parse_number_fail().into(),
|
||||||
AnkiError::FilteredDeckError(err) => err.localized_description(tr),
|
AnkiError::FilteredDeckError(err) => err.localized_description(tr),
|
||||||
|
AnkiError::InvalidRegex(err) => format!("<pre>{}</pre>", err),
|
||||||
_ => format!("{:?}", self),
|
_ => format!("{:?}", self),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,6 @@ pub enum SearchErrorKind {
|
||||||
InvalidPositiveWholeNumber { provided: String, context: String },
|
InvalidPositiveWholeNumber { provided: String, context: String },
|
||||||
InvalidNegativeWholeNumber { provided: String, context: String },
|
InvalidNegativeWholeNumber { provided: String, context: String },
|
||||||
InvalidAnswerButton { provided: String, context: String },
|
InvalidAnswerButton { provided: String, context: String },
|
||||||
Regex(String),
|
|
||||||
Other(Option<String>),
|
Other(Option<String>),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,9 +95,6 @@ impl SearchErrorKind {
|
||||||
SearchErrorKind::InvalidPropOperator(ctx) => {
|
SearchErrorKind::InvalidPropOperator(ctx) => {
|
||||||
tr.search_invalid_prop_operator(ctx.as_str())
|
tr.search_invalid_prop_operator(ctx.as_str())
|
||||||
}
|
}
|
||||||
SearchErrorKind::Regex(text) => {
|
|
||||||
format!("<pre>`{}`</pre>", text.replace('`', "'")).into()
|
|
||||||
}
|
|
||||||
SearchErrorKind::Other(Some(info)) => info.into(),
|
SearchErrorKind::Other(Some(info)) => info.into(),
|
||||||
SearchErrorKind::Other(None) => tr.search_invalid_other(),
|
SearchErrorKind::Other(None) => tr.search_invalid_other(),
|
||||||
SearchErrorKind::InvalidNumber { provided, context } => {
|
SearchErrorKind::InvalidNumber { provided, context } => {
|
||||||
|
|
Loading…
Reference in a new issue