From 600979e74536c8ffe6dffdc1cca780d7e8bd5c76 Mon Sep 17 00:00:00 2001 From: derxe <42929423+derxe@users.noreply.github.com> Date: Tue, 5 Mar 2019 03:53:57 +0100 Subject: [PATCH] Fix bug where API returns noteid even when no note is added --- AnkiConnect.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/AnkiConnect.py b/AnkiConnect.py index e8a3ba6..0c766b2 100644 --- a/AnkiConnect.py +++ b/AnkiConnect.py @@ -725,7 +725,9 @@ class AnkiConnect: collection = self.collection() self.startEditing() - collection.addNote(ankiNote) + nCardsAdded = collection.addNote(ankiNote) + if nCardsAdded < 1: + raise Exception('The field values you have provided would make an empty question on all cards.') collection.autosave() self.stopEditing()