lernsax.util.exceptions

 1class ConsequentialError(Exception):
 2    def __init__(*args, **kwargs):
 3        Exception.__init__(*args, **kwargs)
 4
 5
 6class NotLoggedIn(Exception):
 7    def __init__(*args, **kwargs):
 8        Exception.__init__(*args, **kwargs)
 9
10
11class AccessDenied(Exception):
12    def __init__(*args, **kwargs):
13        Exception.__init__(*args, **kwargs)
14
15
16class InvalidSession(Exception):
17    def __init__(*args, **kwargs):
18        Exception.__init__(*args, **kwargs)
19
20
21class MailError(Exception):
22    def __init__(*args, **kwargs):
23        Exception.__init__(*args, **kwargs)
24
25
26class FolderNotFound(Exception):
27    def __init__(*args, **kwargs):
28        Exception.__init__(*args, **kwargs)
29
30
31class EntryNotFound(Exception):
32    def __init__(*args, **kwargs):
33        Exception.__init__(*args, **kwargs)
34
35
36class UnkownError(Exception):
37    def __init__(*args, **kwargs):
38        Exception.__init__(*args, **kwargs)
39
40
41def error_handler(errno: str) -> Exception:
42    """
43    returns an Exception for the given error code
44    """
45    err_dict = {
46        "107": AccessDenied,
47        "103": AccessDenied,
48        "106": InvalidSession,
49        "111": MailError,
50        "247": FolderNotFound,
51        "117": EntryNotFound,
52        "9999": ConsequentialError
53    }
54    if errno in err_dict:
55        return err_dict[errno]
56    else:
57        return UnkownError
class ConsequentialError(builtins.Exception):
2class ConsequentialError(Exception):
3    def __init__(*args, **kwargs):
4        Exception.__init__(*args, **kwargs)

Common base class for all non-exit exceptions.

ConsequentialError(**kwargs)
3    def __init__(*args, **kwargs):
4        Exception.__init__(*args, **kwargs)
Inherited Members
builtins.BaseException
with_traceback
args
class NotLoggedIn(builtins.Exception):
7class NotLoggedIn(Exception):
8    def __init__(*args, **kwargs):
9        Exception.__init__(*args, **kwargs)

Common base class for all non-exit exceptions.

NotLoggedIn(**kwargs)
8    def __init__(*args, **kwargs):
9        Exception.__init__(*args, **kwargs)
Inherited Members
builtins.BaseException
with_traceback
args
class AccessDenied(builtins.Exception):
12class AccessDenied(Exception):
13    def __init__(*args, **kwargs):
14        Exception.__init__(*args, **kwargs)

Common base class for all non-exit exceptions.

AccessDenied(**kwargs)
13    def __init__(*args, **kwargs):
14        Exception.__init__(*args, **kwargs)
Inherited Members
builtins.BaseException
with_traceback
args
class InvalidSession(builtins.Exception):
17class InvalidSession(Exception):
18    def __init__(*args, **kwargs):
19        Exception.__init__(*args, **kwargs)

Common base class for all non-exit exceptions.

InvalidSession(**kwargs)
18    def __init__(*args, **kwargs):
19        Exception.__init__(*args, **kwargs)
Inherited Members
builtins.BaseException
with_traceback
args
class MailError(builtins.Exception):
22class MailError(Exception):
23    def __init__(*args, **kwargs):
24        Exception.__init__(*args, **kwargs)

Common base class for all non-exit exceptions.

MailError(**kwargs)
23    def __init__(*args, **kwargs):
24        Exception.__init__(*args, **kwargs)
Inherited Members
builtins.BaseException
with_traceback
args
class FolderNotFound(builtins.Exception):
27class FolderNotFound(Exception):
28    def __init__(*args, **kwargs):
29        Exception.__init__(*args, **kwargs)

Common base class for all non-exit exceptions.

FolderNotFound(**kwargs)
28    def __init__(*args, **kwargs):
29        Exception.__init__(*args, **kwargs)
Inherited Members
builtins.BaseException
with_traceback
args
class EntryNotFound(builtins.Exception):
32class EntryNotFound(Exception):
33    def __init__(*args, **kwargs):
34        Exception.__init__(*args, **kwargs)

Common base class for all non-exit exceptions.

EntryNotFound(**kwargs)
33    def __init__(*args, **kwargs):
34        Exception.__init__(*args, **kwargs)
Inherited Members
builtins.BaseException
with_traceback
args
class UnkownError(builtins.Exception):
37class UnkownError(Exception):
38    def __init__(*args, **kwargs):
39        Exception.__init__(*args, **kwargs)

Common base class for all non-exit exceptions.

UnkownError(**kwargs)
38    def __init__(*args, **kwargs):
39        Exception.__init__(*args, **kwargs)
Inherited Members
builtins.BaseException
with_traceback
args
def error_handler(errno: str) -> Exception:
42def error_handler(errno: str) -> Exception:
43    """
44    returns an Exception for the given error code
45    """
46    err_dict = {
47        "107": AccessDenied,
48        "103": AccessDenied,
49        "106": InvalidSession,
50        "111": MailError,
51        "247": FolderNotFound,
52        "117": EntryNotFound,
53        "9999": ConsequentialError
54    }
55    if errno in err_dict:
56        return err_dict[errno]
57    else:
58        return UnkownError

returns an Exception for the given error code