An Error during offlineimap synchronization
| 1 | class OfflineImapError(Exception): |
| 2 | """An Error during offlineimap synchronization""" |
| 3 | |
| 4 | class ERROR: |
| 5 | """Severity level of an Exception |
| 6 | |
| 7 | * **MESSAGE**: Abort the current message, but continue with folder |
| 8 | * **FOLDER_RETRY**: Error syncing folder, but do retry |
| 9 | * **FOLDER**: Abort folder sync, but continue with next folder |
| 10 | * **REPO**: Abort repository sync, continue with next account |
| 11 | * **CRITICAL**: Immediately exit offlineimap |
| 12 | """ |
| 13 | |
| 14 | MESSAGE, FOLDER_RETRY, FOLDER, REPO, CRITICAL = 0, 10, 15, 20, 30 |
| 15 | |
| 16 | def __init__(self, reason, severity, errcode=None): |
| 17 | """ |
| 18 | :param reason: Human readable string suitable for logging |
| 19 | |
| 20 | :param severity: denoting which operations should be |
| 21 | aborted. E.g. a ERROR.MESSAGE can occur on a faulty |
| 22 | message, but a ERROR.REPO occurs when the server is |
| 23 | offline. |
| 24 | |
| 25 | :param errcode: optional number denoting a predefined error |
| 26 | situation (which let's us exit with a predefined exit |
| 27 | value). So far, no errcodes have been defined yet. |
| 28 | |
| 29 | :type severity: OfflineImapError.ERROR value""" |
| 30 | |
| 31 | self.errcode = errcode |
| 32 | self.severity = severity |
| 33 | |
| 34 | # 'reason' is stored in the Exception().args tuple. |
| 35 | super(OfflineImapError, self).__init__(reason) |
| 36 | |
| 37 | @property |
| 38 | def reason(self): |
| 39 | return self.args[0] |
no outgoing calls
no test coverage detected