More informative error message in anki-editor-api-check

Increases user-friendliness, as discussed in orgtre/anki-editor#5.
This commit is contained in:
orgtre 2022-11-02 11:05:03 +01:00
parent 6f5df94102
commit b0ecbbe4ad

View file

@ -1045,7 +1045,10 @@ When note heading is not provided, it is used as the first field."
(interactive)
(let ((ver (condition-case err
(anki-editor-api-call-result 'version)
(error (error "Failed to connect to Anki: %s" (error-message-string err))))))
(error (error (concat "Failed to connect to Anki: %s"
"\nIs Anki running with the "
"AnkiConnect add-on enabled?")
(error-message-string err))))))
(if (<= anki-editor-api-version ver)
(when (called-interactively-p 'interactive)
(message "AnkiConnect v.%d is running" ver))