handle notes with missing cards in browser
https://forums.ankiweb.net/t/2-1-45-release-candidate/11362/30
This commit is contained in:
parent
23356304fc
commit
5e10087aae
@ -8,3 +8,4 @@ errors-100-tags-max =
|
||||
tags you want instead of the ones you don't want is usually simpler, and there
|
||||
is no need to select child tags if you have selected a parent tag.
|
||||
errors-multiple-notetypes-selected = Please select notes from only one notetype.
|
||||
errors-please-check-database = Please use the Check Database action, then try again.
|
||||
|
@ -32,6 +32,7 @@ impl AnkiError {
|
||||
AnkiError::InvalidRegex(_) => Kind::InvalidInput,
|
||||
AnkiError::UndoEmpty => Kind::UndoEmpty,
|
||||
AnkiError::MultipleNotetypesSelected => Kind::InvalidInput,
|
||||
AnkiError::DatabaseCheckRequired => Kind::InvalidInput,
|
||||
};
|
||||
|
||||
pb::BackendError {
|
||||
|
@ -260,6 +260,9 @@ impl RowContext {
|
||||
if notes_mode {
|
||||
note = col.get_note_maybe_with_fields(NoteId(id), with_card_render)?;
|
||||
cards = col.storage.all_cards_of_note(note.id)?;
|
||||
if cards.is_empty() {
|
||||
return Err(AnkiError::DatabaseCheckRequired);
|
||||
}
|
||||
} else {
|
||||
cards = vec![col
|
||||
.storage
|
||||
|
@ -40,6 +40,7 @@ pub enum AnkiError {
|
||||
InvalidRegex(String),
|
||||
UndoEmpty,
|
||||
MultipleNotetypesSelected,
|
||||
DatabaseCheckRequired,
|
||||
}
|
||||
|
||||
impl Display for AnkiError {
|
||||
@ -92,6 +93,7 @@ impl AnkiError {
|
||||
AnkiError::FilteredDeckError(err) => err.localized_description(tr),
|
||||
AnkiError::InvalidRegex(err) => format!("<pre>{}</pre>", err),
|
||||
AnkiError::MultipleNotetypesSelected => tr.errors_multiple_notetypes_selected().into(),
|
||||
AnkiError::DatabaseCheckRequired => tr.errors_please_check_database().into(),
|
||||
AnkiError::IoError(_)
|
||||
| AnkiError::JsonError(_)
|
||||
| AnkiError::ProtoError(_)
|
||||
|
Loading…
Reference in New Issue
Block a user