info-gnus-english
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to trap an error when connecting to a news server


From: gnus
Subject: How to trap an error when connecting to a news server
Date: Sat, 04 Jan 2020 14:01:58 +0000

I have this code:

(defun news-check ()
 (message "The result is %d" (gnus-group-get-new-news))
)

(defun news-update ()
 (interactive)
 (setq quit-for t)
 (while (eq quit-for t) ;; this stops if a key is pressed
   (setq nnnn 0)        ;; This counts seconds and displays them
   (while (and (< nnnn 600) (eq t quit-for))
     (setq quit-for (sit-for 1)) ;; wait for a second, or a key
     (message "count %s" nnnn)
     (setq nnnn (+ 1 nnnn))
     )
   (message "checking...")
   (news-check)        ;; this calls the above news check
   )
)

If the server closes the connection, then this while loop stops. How can
I trap the error and continue the loop so that it tries again in 600
seconds?

I have tried using the condition-case mentioned in the manual but it
seemed to have no effect:

(defun news-check ()
 (condition-case err
     (message "The result is %s" (gnus-group-get-new-news))
   (news-error
    (message "I expect the server closed again %s",err)
    )
   )
)

Sorry if you see this more than once. I posted it to the newsgroup but now I suspect the newsgroup is read-only.


Sent with Criptext secure email
reply via email to

[Prev in Thread] Current Thread [Next in Thread]