i18n error shown when attempting to rebuild normal deck

This commit is contained in:
Damien Elmes 2021-04-01 22:55:10 +10:00
parent ac1b9fadde
commit f55fe6e518
3 changed files with 5 additions and 2 deletions

View File

@ -2,3 +2,4 @@ errors-invalid-input-empty = Invalid input.
errors-invalid-input-details = Invalid input: { $details }
errors-parse-number-fail = A number was invalid or out of range.
errors-filtered-parent-deck = Filtered decks can not have child decks.
errors-filtered-deck-required = This action can only be used on a filtered deck.

View File

@ -107,7 +107,7 @@ impl Deck {
if let DeckKind::Filtered(filtered) = &self.kind {
Ok(filtered)
} else {
Err(AnkiError::invalid_input("deck not filtered"))
Err(FilteredDeckError::FilteredDeckRequired.into())
}
}
@ -116,7 +116,7 @@ impl Deck {
if let DeckKind::Filtered(filtered) = &mut self.kind {
Ok(filtered)
} else {
Err(AnkiError::invalid_input("deck not filtered"))
Err(FilteredDeckError::FilteredDeckRequired.into())
}
}

View File

@ -10,6 +10,7 @@ pub enum FilteredDeckError {
MustBeLeafNode,
CanNotMoveCardsInto,
SearchReturnedNoCards,
FilteredDeckRequired,
}
impl FilteredDeckError {
@ -20,6 +21,7 @@ impl FilteredDeckError {
tr.browsing_cards_cant_be_manually_moved_into()
}
FilteredDeckError::SearchReturnedNoCards => tr.decks_filtered_deck_search_empty(),
FilteredDeckError::FilteredDeckRequired => tr.errors_filtered_deck_required(),
}
.into()
}