[Top][All Lists]

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

RE: How to trap an error when connecting to a news server

From: gnus
Subject: RE: How to trap an error when connecting to a news server
Date: Sat, 04 Jan 2020 19:31:05 +0000

On Sat, 4 Jan 2020 at 7:09 PM, Bob Newell < > wrote:

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

I could be mistaken in this, but in your code above, where did you get 'news-error' as the name of the error condition raised? I can't find this anywhere in the gnus source tree. Do you know for sure that gnus-group-get-new-news (or anything it calls) raises that condition?

Thank you for your response. It is useful to me that you ask this. I could not tell from the manual that "arith-error" in the example had a specific meaning, so I arbitrarily changed it.

How do I tell what the error condition will be? The code in nntp.el is this (I think this is where the server closed condition occurs) :

(defun nntp-report (&rest args)                                                                                                     
 "Report an error from the nntp backend.  The first string in ARGS                                                                 
can be a format string.  For some commands, the failed command may be                                                               
retried once before actually displaying the error report."                                                                          
 (if nntp--report-1                                                                                                                
       ;; Throw out to nntp-with-open-group-error so that the connection may                                                       
       ;; be restored and the command retried."                                                                                    
       (when nntp-record-commands                                                                                                  
         (nntp-record-command "*** CONNECTION LOST ***"))                                                                          
       (throw 'nntp-with-open-group-error t))                                                                                      
   (when nntp-record-commands                                                                                                      
     (nntp-record-command "*** CALLED nntp-report ***"))                                                                           
   (nnheader-report 'nntp args)                                                                                                    
   (apply 'error args)                                                                                                             

reply via email to

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