Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
From: gnus via info-gnus-english <info-gnus-english@gnu.org>
To: info-gnus-english@gnu.org
Subject: How to trap an error when connecting to a news server
Date: Sat, 04 Jan 2020 14:01:58 +0000	[thread overview]
Message-ID: <1578146518407.757655@criptext.com> (raw)
In-Reply-To: <1578146518407.757655@criptext.com>


[-- Attachment #1.1: Type: text/plain, Size: 1172 bytes --]

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[https://api.criptext.com/email/open/%3C1578146518407.757655%40criptext.com%3E]

[-- Attachment #1.2: Type: text/html, Size: 1983 bytes --]

[-- Attachment #2: Type: text/plain, Size: 162 bytes --]

_______________________________________________
info-gnus-english mailing list
info-gnus-english@gnu.org
https://lists.gnu.org/mailman/listinfo/info-gnus-english

       reply	other threads:[~2020-01-04 14:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-04 14:01 gnus via info-gnus-english [this message]
2020-01-04 19:08 ` Bob Newell
2020-01-04 19:31 ` gnus via info-gnus-english
2020-01-04 20:20 ` gnus via info-gnus-english

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1578146518407.757655@criptext.com \
    --to=info-gnus-english@gnu.org \
    --cc=gnus@criptext.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).