Martin Panter added the comment:

NNTPConnectError does still seem a slightly awkward name. I would go for 
NNTPConnectionError instead, but I’m also happy to put my bikeshed paint away 
let this patch be applied as is :)

Handling of NNTPTemporaryError with a code of 400 is similar to handling of 
this EOFError. But I guess there is not much you could do with the API unless 
you made a separate subclass for 400 errors (like all the new 
EnvironmentError/OSError subclasses), which would be rather severe. My current 
workaround looks a bit like this:

try:
    [_, info] = nntp.body(...)
except NNTPTemporaryError as err:
    [code, *msg] = err.response.split(maxsplit=1)
    if code != "400":
        raise
except EOFError:  # Or NNTPConnect(ion)Error
    msg = ()
else:
    break  # Handle successful response
[msg] = msg or ("Server shut down connection",)
# Handle connection shutdown by server

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue1186900>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to