1
1
class GitModelError (Exception ):
2
2
"""A base exception for other gitmodel-related errors."""
3
+
3
4
pass
4
5
5
6
6
7
class ConfigurationError (GitModelError ):
7
8
"""Raised during configuration errors"""
9
+
8
10
pass
9
11
10
12
11
13
class UnsupportedFormat (GitModelError ):
12
14
"""
13
15
Raised when an unsupported serialization format is requested.
14
16
"""
17
+
15
18
pass
16
19
17
20
18
21
class FieldError (GitModelError ):
19
22
"""
20
23
Raised when there is a configuration error with a ``Field``.
21
24
"""
25
+
22
26
pass
23
27
24
28
25
29
class DoesNotExist (GitModelError ):
26
30
"""
27
31
Raised when the object in question can't be found.
28
32
"""
33
+
29
34
pass
30
35
31
36
32
37
class RepositoryError (GitModelError ):
33
38
"""
34
39
Raises during an error while operating with the repository
35
40
"""
41
+
36
42
pass
37
43
38
44
@@ -46,13 +52,14 @@ class ValidationError(GitModelError):
46
52
"""
47
53
Raised when an invalid value is encountered
48
54
"""
55
+
49
56
def __init__ (self , msg_or_code , field = None , ** kwargs ):
50
57
self .field = field
51
58
self .msg_or_code = msg_or_code
52
59
if self .field :
53
- msg = self .field .get_error_message (msg_or_code ,
54
- default = msg_or_code ,
55
- ** kwargs )
60
+ msg = self .field .get_error_message (
61
+ msg_or_code , default = msg_or_code , ** kwargs
62
+ )
56
63
else :
57
64
msg = msg_or_code
58
65
super (ValidationError , self ).__init__ (msg )
@@ -62,11 +69,13 @@ class IntegrityError(GitModelError):
62
69
"""
63
70
Raised when a save results in duplicate values
64
71
"""
72
+
65
73
pass
66
74
67
75
68
76
class ModelNotFound (Exception ):
69
77
"""
70
78
Raised during deserialization if the model class no longer exists
71
79
"""
80
+
72
81
pass
0 commit comments