-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added 14 new custom lib exceptions (errors.py): MailboxCopyError, M…
…ailboxDeleteError, MailboxExpungeError, MailboxFetchError, MailboxFlagError, MailboxFolderCreateError, MailboxFolderDeleteError, MailboxFolderRenameError, MailboxFolderSelectError, MailboxFolderStatusError, MailboxFolderStatusValueError, MailboxLoginError, MailboxLogoutError, MailboxSearchError * UnexpectedCommandStatusError now not used directly. * Added folder.MailBoxFolderStatusOptions class instead MailBoxFolderManager.folder_status_options * utils.MessageFlags -> message.MailMessageFlags * query.py: ValueError replaced to TypeError in many places * utils.short_month_names renamed to utils.SHORT_MONTH_NAMES * utils.cleaned_uid_set - parsing optimized, raise TypeError instead ValueError * utils.check_command_status - new logic * BaseMailBox.fetch headers_only arg is disabled until fix
- Loading branch information
Showing
15 changed files
with
242 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
class ImapToolsError(Exception): | ||
"""Base lib error""" | ||
|
||
|
||
class MailboxFolderStatusValueError(ImapToolsError): | ||
"""Wrong folder status value error""" | ||
|
||
|
||
class UnexpectedCommandStatusError(ImapToolsError): | ||
"""Unexpected status in IMAP command response""" | ||
|
||
def __init__(self, command_result: tuple, expected: str): | ||
""" | ||
:param command_result: imap command result | ||
:param expected: expected command status | ||
""" | ||
self.command_result = command_result | ||
self.expected = expected | ||
|
||
def __str__(self): | ||
return 'Response status "{exp}" expected, but "{typ}" received. Data: {data}'.format( | ||
exp=self.expected, typ=self.command_result[0], data=str(self.command_result[1])) | ||
|
||
|
||
class MailboxFolderSelectError(UnexpectedCommandStatusError): | ||
pass | ||
|
||
|
||
class MailboxFolderCreateError(UnexpectedCommandStatusError): | ||
pass | ||
|
||
|
||
class MailboxFolderRenameError(UnexpectedCommandStatusError): | ||
pass | ||
|
||
|
||
class MailboxFolderDeleteError(UnexpectedCommandStatusError): | ||
pass | ||
|
||
|
||
class MailboxFolderStatusError(UnexpectedCommandStatusError): | ||
pass | ||
|
||
|
||
class MailboxLoginError(UnexpectedCommandStatusError): | ||
pass | ||
|
||
|
||
class MailboxLogoutError(UnexpectedCommandStatusError): | ||
pass | ||
|
||
|
||
class MailboxSearchError(UnexpectedCommandStatusError): | ||
pass | ||
|
||
|
||
class MailboxFetchError(UnexpectedCommandStatusError): | ||
pass | ||
|
||
|
||
class MailboxExpungeError(UnexpectedCommandStatusError): | ||
pass | ||
|
||
|
||
class MailboxDeleteError(UnexpectedCommandStatusError): | ||
pass | ||
|
||
|
||
class MailboxCopyError(UnexpectedCommandStatusError): | ||
pass | ||
|
||
|
||
class MailboxFlagError(UnexpectedCommandStatusError): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.