branch: elpa/gnosis
commit cbb694bc9c89091faa7259f39c84ba97bbc25743
Author: Thanos Apollo <[email protected]>
Commit: Thanos Apollo <[email protected]>

    [Refactor] view-link: Handle errors in review actions.
    
    * user-error would break review session.
    * gnosis-get-linked-nodes will be used for future functions to return
      for filtering.
---
 gnosis.el | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/gnosis.el b/gnosis.el
index 7e1b6817909..e7f75a6fc32 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -888,8 +888,7 @@ START is the search starting position, used internally for 
recursion."
   (let* ((links (gnosis-select 'dest 'links `(= source ,id) t))
         (org-gnosis-nodes (cl-loop for node-id in links
                                    collect (org-gnosis-select 'title 'nodes 
`(= id ,node-id) t))))
-    (if links (apply #'append org-gnosis-nodes)
-      (user-error (format "No linked nodes found for thema: %d" id)))))
+    (and links (apply #'append org-gnosis-nodes))))
 
 (defun gnosis-view-linked-node (id)
   "Visit linked node(s) for thema ID."
@@ -1375,8 +1374,11 @@ be called with new SUCCESS value plus THEMA & 
THEMA-COUNT."
 
 (defun gnosis-review-action--view-link (success thema thema-count)
   "View linked node(s) for THEMA."
-  (gnosis-view-linked-node thema)
-  (recursive-edit)
+  (if (gnosis-get-linked-nodes thema)
+    (progn (gnosis-view-linked-node thema)
+          (recursive-edit))
+    (message (format "No linked nodes for thema: %d" thema))
+    (sleep-for 0.5))
   (gnosis-review-actions success thema thema-count))
 
 (defun gnosis-review-actions (success id thema-count)

Reply via email to