From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.user/19094 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: gnus via info-gnus-english Newsgroups: gmane.emacs.gnus.user Subject: How to trap an error when connecting to a news server Date: Sat, 04 Jan 2020 14:01:58 +0000 Message-ID: <1578146518407.757655@criptext.com> References: <1578146518407.757655@criptext.com> Reply-To: gnus Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============3905930353243374658==" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="121205"; mail-complaints-to="usenet@blaine.gmane.org" To: info-gnus-english@gnu.org Original-X-From: info-gnus-english-bounces+gegu-info-gnus-english=m.gmane.org@gnu.org Sat Jan 04 15:50:33 2020 Return-path: Envelope-to: gegu-info-gnus-english@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1inkl6-000VOk-TR for gegu-info-gnus-english@m.gmane.org; Sat, 04 Jan 2020 15:50:33 +0100 Original-Received: from localhost ([::1]:34518 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1inkl5-00035o-PY for gegu-info-gnus-english@m.gmane.org; Sat, 04 Jan 2020 09:50:31 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57824) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ink0B-00068t-6H for info-gnus-english@gnu.org; Sat, 04 Jan 2020 09:02:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ink09-0006JL-Qp for info-gnus-english@gnu.org; Sat, 04 Jan 2020 09:02:03 -0500 Original-Received: from smtp.criptext.com ([52.37.193.129]:48286) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ink09-0006BG-E6 for info-gnus-english@gnu.org; Sat, 04 Jan 2020 09:02:01 -0500 Original-Received: (Haraka outbound); Sat, 04 Jan 2020 14:01:58 +0000 Authentication-Results: smtp.criptext.com; auth=pass (plain) Original-Received: from [127.0.0.1] (ec2-34-221-2-169.us-west-2.compute.amazonaws.com [34.221.2.169]) by smtp.criptext.com (Haraka/2.8.20) with ESMTPSA id 451A81AC-88C5-4E58-B6F8-84395079D176.1 envelope-from (authenticated bits=0) (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES128-GCM-SHA256 verify=FAIL); Sat, 04 Jan 2020 14:01:58 +0000 In-Reply-To: <1578146518407.757655@criptext.com> DKIM-Signature: v=1; a=rsa-sha256; bh=B6BAgr1fwMeXkSucPVUigreq4S5K+r5Wsa7Y6jSSl6w=; c=relaxed/simple; d=criptext.com; h=from:subject:date:message-id:to:mime-version; s=criptext; b=GwIcq/2vC1wUeQU6GHYPBiyAqfLhwyos0eFlvfhZcAwdkFfmvUTNwIrlJ9viO0bMDjX3xPnGZN+M8+trpktJxZXTpHhYWjqrbFNiWKKqpszovUJ9SRAzWM4sY6Mc5ppHSn2gppc40MUj7Rt+6oZb+DnGnC57zByf27CfIlfJ5O8Q9IzM7zFuscuWgJzAGXDR23m8eAWuJ0+zJ1GH+s6Lg3XVgt5Xby4zF/lLuGDr1ChrepFfUt18eTvvK6KFRg4iQI1hwgZVfynPTOqFA8uNPPP00fAaJx4tqmHi/lsNCg5L1WegSaZqXuYHUiHiHlsuEew6Dx9bj8ww+BE6QCik+w== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 52.37.193.129 X-Mailman-Approved-At: Sat, 04 Jan 2020 09:50:30 -0500 X-BeenThere: info-gnus-english@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Announcements and discussions for GNUS, the GNU Emacs Usenet newsreader \(in English\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: info-gnus-english-bounces+gegu-info-gnus-english=m.gmane.org@gnu.org Original-Sender: "info-gnus-english" Xref: news.gmane.org gmane.emacs.gnus.user:19094 Archived-At: --===============3905930353243374658== Content-Type: multipart/alternative; boundary="--_NmP-28328e978d90527e-Part_1" ----_NmP-28328e978d90527e-Part_1 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable 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] ----_NmP-28328e978d90527e-Part_1 Content-Type: text/html Content-Transfer-Encoding: quoted-printable
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)       &n= bsp;;; This counts seconds and displays them
   (while = (and (< nnnn 600) (eq t quit-for))
     (s= etq 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 ----_NmP-28328e978d90527e-Part_1-- --===============3905930353243374658== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KaW5mby1nbnVz LWVuZ2xpc2ggbWFpbGluZyBsaXN0CmluZm8tZ251cy1lbmdsaXNoQGdudS5vcmcKaHR0cHM6Ly9s aXN0cy5nbnUub3JnL21haWxtYW4vbGlzdGluZm8vaW5mby1nbnVzLWVuZ2xpc2gK --===============3905930353243374658==--