From c76166e31836276bd7ce47eeff05a4b5d3d2ee9b Mon Sep 17 00:00:00 2001 From: louie Date: Mon, 24 Feb 2020 17:40:41 +0800 Subject: [PATCH] Capture connection error --- anki-editor.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/anki-editor.el b/anki-editor.el index 3684873..91fa3d2 100644 --- a/anki-editor.el +++ b/anki-editor.el @@ -878,7 +878,9 @@ When note heading is not provided, it is used as the first field." (defun anki-editor-api-check () "Check if correct version of AnkiConnect is serving." (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) (when (called-interactively-p 'interactive) (message "AnkiConnect v.%d is running" ver))