Capture connection error
This commit is contained in:
parent
c47dfade3a
commit
c76166e318
1 changed files with 3 additions and 1 deletions
|
@ -878,7 +878,9 @@ When note heading is not provided, it is used as the first field."
|
||||||
(defun anki-editor-api-check ()
|
(defun anki-editor-api-check ()
|
||||||
"Check if correct version of AnkiConnect is serving."
|
"Check if correct version of AnkiConnect is serving."
|
||||||
(interactive)
|
(interactive)
|
||||||
(let ((ver (anki-editor-api-call-result 'version)))
|
(let ((ver (condition-case err
|
||||||
|
(anki-editor-api-call-result 'version)
|
||||||
|
(error (error "Failed to connect to Anki: %s" (error-message-string err))))))
|
||||||
(if (<= anki-editor-api-version ver)
|
(if (<= anki-editor-api-version ver)
|
||||||
(when (called-interactively-p 'interactive)
|
(when (called-interactively-p 'interactive)
|
||||||
(message "AnkiConnect v.%d is running" ver))
|
(message "AnkiConnect v.%d is running" ver))
|
||||||
|
|
Loading…
Reference in a new issue