From 844591cdada4c08ce0ac16ca8ddef8a6ddb3f4e7 Mon Sep 17 00:00:00 2001 From: Menno Smits Date: Tue, 17 Nov 2015 17:02:08 +1300 Subject: [PATCH] Updated exceptions documentation for 1.0 --- doc/src/index.rst | 35 ++++++++++++++++++++++++----------- doc/src/releases.rst | 5 +++++ 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/doc/src/index.rst b/doc/src/index.rst index 7be4e94..28b962d 100644 --- a/doc/src/index.rst +++ b/doc/src/index.rst @@ -137,17 +137,6 @@ If *folder_encode* is True, all folder names returned by IMAPClient are always returned as unicode strings. If *folder_encode* is False, folder names are returned as str (Python 2) or bytes (Python 3). -Exceptions -~~~~~~~~~~ -The IMAP related exceptions that will be raised by this class are: - -* IMAPClient.Error -* IMAPClient.AbortError -* IMAPClient.ReadOnlyError - -These are aliases for the imaplib.IMAP4 exceptions of the same name. Socket -errors may also be raised in the case of network errors. - TLS/SSL ~~~~~~~ IMAPClient uses sensible TLS parameter defaults for encrypted @@ -206,6 +195,30 @@ Here's an example of how gevent_openssl can be used with IMAPClient:: .. _gevent: http://www.gevent.org/ .. _`gevent_openssl`: https://pypi.python.org/pypi/gevent_openssl/ + +Exceptions +~~~~~~~~~~ +The following exceptions may be raised by IMAPClient directly. They +are attached to the IMAPClient class. + +* IMAPClient.Error: the base class for IMAPClient's exceptions and the + most commonly used error. +* IMAPClient.AbortError: raised if a serious error has occurred that + means the IMAP connection is no longer usable. The connection should + be dropped without logout if this occurs. +* IMAPClient.ReadOnlyError: raised if a modifying operation was + attempted on a read-only folder. + +Exceptions from lower network layers are also possible, in particular: + +* socket.error +* socket.timeout: raised if a timeout was specified when creating the + IMAPClient instance and a network operation takes too long. +* backports.ssl.SSLError: the base class for network or SSL protocol + errors when ssl=True or starttls() is used. +* backports.ssl.CertificateError: raised when TLS certification + verification fails. This is *not* a subclass of SSLError. + API Reference ------------- diff --git a/doc/src/releases.rst b/doc/src/releases.rst index 2e2077d..0d81d84 100644 --- a/doc/src/releases.rst +++ b/doc/src/releases.rst @@ -34,6 +34,9 @@ Compatibility breaks: may fail now (especially if a self-signed certificate is used by the server). Refer to the documentation for details of how to supply alternate CA certificates or disable verification. +4. There are some new exceptions that might be raised in response to + network issues or TLS protocol failures. Refer to the + Exceptions_ section of the manual for more details. Please refer to the "TLS/SSL" section of the manual for more details on all of the above. @@ -41,6 +44,8 @@ on all of the above. Many thanks to Chris Arndt and Marc-Antoine Parent for their input into these TLS improvements. +.. _Exceptions: http://imapclient.readthedocs.org/en/latest/#exceptions + STARTTLS support [NEW] ---------------------- When the server supports it, IMAPClient can now establish an encrypted -- 2.43.0