diff --git a/ftl/core/errors.ftl b/ftl/core/errors.ftl index 01d084d8c..f1a4c5934 100644 --- a/ftl/core/errors.ftl +++ b/ftl/core/errors.ftl @@ -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. diff --git a/rslib/src/backend/error.rs b/rslib/src/backend/error.rs index c548d5966..8a5e8e676 100644 --- a/rslib/src/backend/error.rs +++ b/rslib/src/backend/error.rs @@ -32,6 +32,7 @@ impl AnkiError { AnkiError::InvalidRegex(_) => Kind::InvalidInput, AnkiError::UndoEmpty => Kind::UndoEmpty, AnkiError::MultipleNotetypesSelected => Kind::InvalidInput, + AnkiError::DatabaseCheckRequired => Kind::InvalidInput, }; pb::BackendError { diff --git a/rslib/src/browser_table.rs b/rslib/src/browser_table.rs index 634729db5..9e7e64d06 100644 --- a/rslib/src/browser_table.rs +++ b/rslib/src/browser_table.rs @@ -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 diff --git a/rslib/src/error/mod.rs b/rslib/src/error/mod.rs index d0014e114..324976a16 100644 --- a/rslib/src/error/mod.rs +++ b/rslib/src/error/mod.rs @@ -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!("
{}", err), AnkiError::MultipleNotetypesSelected => tr.errors_multiple_notetypes_selected().into(), + AnkiError::DatabaseCheckRequired => tr.errors_please_check_database().into(), AnkiError::IoError(_) | AnkiError::JsonError(_) | AnkiError::ProtoError(_)