forked from FMFI-UK-1-AIN-412/glm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
errors.py
67 lines (42 loc) · 1.42 KB
/
errors.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
from typing import Optional
from plumbum.colors import info, fatal
class GLMException(Exception):
def __init__(
self, message: str, hint: Optional[str] = None, fatal: Optional[bool] = False
):
super().__init__(message)
self.message = message
self.hint = hint
self.fatal = fatal
def print_message(self):
print(fatal | self.message)
def print_hint(self):
if self.hint:
print("Hint ", end="")
print(info | self.hint)
def show(self):
self.print_message()
self.print_hint()
class ConfigFileException(GLMException):
pass
class CoreFileException(GLMException):
pass
class StudentDeleteException(GLMException):
pass
class StudentDoesNotExists(GLMException):
pass
class RootDirectoryNotFoundException(GLMException):
pass
class BadCredentialsException(GLMException):
def __init__(self, message: str, hint: Optional[str] = None):
super().__init__(message, hint, True)
class NoInternetConnectionException(GLMException):
def __init__(self, fatal: Optional[bool] = True):
super().__init__("No internet connection", None, fatal)
class RepositorySetupException(GLMException):
pass
class WrongLocationException(GLMException):
def __init__(self, message: str, hint: Optional[str] = None):
super().__init__(message, hint, True)
class GitException(GLMException):
pass