Merge pull request #112 from derxe/patch-3

Fix bug where API returns noteid even when no note is added
This commit is contained in:
Alex Yatskov 2019-03-04 19:25:35 -08:00 committed by GitHub
commit 77a558fc31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -725,7 +725,9 @@ class AnkiConnect:
collection = self.collection() collection = self.collection()
self.startEditing() 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() collection.autosave()
self.stopEditing() self.stopEditing()