1import imaplib 2 3# Base class allowing to catch any IMAPClient related exceptions 4# To ensure backward compatibility, we "rename" the imaplib general 5# exception class, so we can catch its exceptions without having to 6# deal with it in IMAPClient codebase 7IMAPClientError = imaplib.IMAP4.error 8IMAPClientAbortError = imaplib.IMAP4.abort 9IMAPClientReadOnlyError = imaplib.IMAP4.readonly 10 11 12class CapabilityError(IMAPClientError): 13 """ 14 The command tried by the user needs a capability not installed 15 on the IMAP server 16 """ 17 18 19class LoginError(IMAPClientError): 20 """ 21 A connection has been established with the server but an error 22 occurred during the authentication. 23 """ 24 25 26class IllegalStateError(IMAPClientError): 27 """ 28 The command tried needs a different state to be executed. This 29 means the user is not logged in or the command needs a folder to 30 be selected. 31 """ 32 33 34class InvalidCriteriaError(IMAPClientError): 35 """ 36 A command using a search criteria failed, probably due to a syntax 37 error in the criteria string. 38 """ 39 40 41class ProtocolError(IMAPClientError): 42 """The server replied with a response that violates the IMAP protocol.""" 43