tiferet 1.0.0a12__py3-none-any.whl → 1.0.0a13__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tiferet/contexts/error.py +27 -1
- tiferet/contexts/feature.py +3 -0
- tiferet/domain/__init__.py +1 -1
- {tiferet-1.0.0a12.dist-info → tiferet-1.0.0a13.dist-info}/METADATA +1 -1
- {tiferet-1.0.0a12.dist-info → tiferet-1.0.0a13.dist-info}/RECORD +8 -8
- {tiferet-1.0.0a12.dist-info → tiferet-1.0.0a13.dist-info}/LICENSE +0 -0
- {tiferet-1.0.0a12.dist-info → tiferet-1.0.0a13.dist-info}/WHEEL +0 -0
- {tiferet-1.0.0a12.dist-info → tiferet-1.0.0a13.dist-info}/top_level.txt +0 -0
tiferet/contexts/error.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# *** imports
|
2
2
|
|
3
3
|
# ** core
|
4
|
-
from typing import Any, Tuple
|
4
|
+
from typing import Any, Tuple, List
|
5
5
|
|
6
6
|
# ** app
|
7
7
|
from ..domain import *
|
@@ -37,10 +37,36 @@ class ErrorContext(Model):
|
|
37
37
|
# Create the errors lookup from the error repository.
|
38
38
|
errors = {error.name: error for error in error_repo.list()}
|
39
39
|
|
40
|
+
# Add custom errors.
|
41
|
+
errors.update({error.name: error for error in self.load_custom_errors()})
|
42
|
+
|
40
43
|
# Set the errors lookup and validate.
|
41
44
|
super().__init__(dict(errors=errors))
|
42
45
|
self.validate()
|
43
46
|
|
47
|
+
# * method: load_custom_errors
|
48
|
+
def load_custom_errors(self) -> List[Error]:
|
49
|
+
'''
|
50
|
+
Load custom errors.
|
51
|
+
|
52
|
+
:return: The list of custom errors.
|
53
|
+
:rtype: list
|
54
|
+
'''
|
55
|
+
|
56
|
+
# Get custom errors.
|
57
|
+
return [
|
58
|
+
Error.new(
|
59
|
+
name='FEATURE_NOT_FOUND',
|
60
|
+
error_code='0',
|
61
|
+
message=[
|
62
|
+
ErrorMessage.new(
|
63
|
+
lang='en_US',
|
64
|
+
text='The feature with ID was not found: {}'
|
65
|
+
)
|
66
|
+
]
|
67
|
+
)
|
68
|
+
]
|
69
|
+
|
44
70
|
# * method: handle_error
|
45
71
|
def handle_error(self, exception: Exception, lang: str = 'en_US', **kwargs) -> Tuple[bool, Any]:
|
46
72
|
'''
|
tiferet/contexts/feature.py
CHANGED
@@ -79,6 +79,9 @@ class FeatureContext(Model):
|
|
79
79
|
:type kwargs: dict
|
80
80
|
'''
|
81
81
|
|
82
|
+
# Assert the feature exists.
|
83
|
+
assert request.feature_id in self.features, 'FEATURE_NOT_FOUND, {}'.format(request.feature_id)
|
84
|
+
|
82
85
|
# Iterate over the feature commands.
|
83
86
|
for command in self.features[request.feature_id].commands:
|
84
87
|
|
tiferet/domain/__init__.py
CHANGED
@@ -9,15 +9,15 @@ tiferet/configs/__init__.py,sha256=NfT6XFNcJznOLXjMuNmj3XeaOPVWwbc-N4kVWaVjuD0,8
|
|
9
9
|
tiferet/contexts/__init__.py,sha256=HjI-9n29mFxN6ILSa3LBhLSVPRe-1V36ffQXSP9RavM,204
|
10
10
|
tiferet/contexts/app.py,sha256=uCSUWZlhieyI97tFgJ0VzHqhBxrPo_if0CLCPEPBSaM,3783
|
11
11
|
tiferet/contexts/container.py,sha256=qQzrAxGoq5yNqijMnVzE2wVwKprBmEVgiaBunnNcMd8,5704
|
12
|
-
tiferet/contexts/error.py,sha256=
|
13
|
-
tiferet/contexts/feature.py,sha256=
|
12
|
+
tiferet/contexts/error.py,sha256=Gqewmk5WqbER9umNvR9gliQNi-bmbaNyXOSG4jUZfJc,3262
|
13
|
+
tiferet/contexts/feature.py,sha256=kVVRpIyjWa3T2QoT2R-T7clOIQEpNMYa8ZJRVxgY_6o,3730
|
14
14
|
tiferet/contexts/request.py,sha256=EwTyXVYi8z1t1ns_0yDrjY6qICIMPn1UvZpV7ULKReY,2756
|
15
15
|
tiferet/data/__init__.py,sha256=JKaeCw508WY15-etqdFJxPUUJxMxCAi6ASmA472D1_s,93
|
16
16
|
tiferet/data/app.py,sha256=TWWwP0MDpQ-LSKg9166CyPSeI7jjcklIfwBlLW_rT5c,9619
|
17
17
|
tiferet/data/container.py,sha256=o2HnLN1LasqWGP_S1Ub32CrCqYzehlD3dgXizW9XfU8,6154
|
18
18
|
tiferet/data/error.py,sha256=Kllt0w62BAyShdVSwATN0LiVTeQHqkyQAN9_HuFg31Q,2339
|
19
19
|
tiferet/data/feature.py,sha256=cjmm0lkmoFiCs0kyTDLH-OruTxTNJQf4BAkjtFu22Tk,2921
|
20
|
-
tiferet/domain/__init__.py,sha256=
|
20
|
+
tiferet/domain/__init__.py,sha256=H6mwtBHSlRZmYqXJcSVUIXLGLC7tNZZX22LuHU3b1ZI,224
|
21
21
|
tiferet/domain/app.py,sha256=uRBKpPJa1IrDtnwQRtu2brDZBniFZcdaxOGOfUIN3e0,4808
|
22
22
|
tiferet/domain/container.py,sha256=wjal73hWAs5EvRO9XbrBBfdpV9nq9J89mAPbd4SH4ws,3666
|
23
23
|
tiferet/domain/core.py,sha256=fOZeGxTJLGzY2zgAoSJu6rVJySpv-vCycT-WcEMk8kI,5152
|
@@ -31,8 +31,8 @@ tiferet/repos/feature.py,sha256=GxOV8XHNwz9YY3I8Wch6GaDskvkdi8l1hM9E9fCg1y0,3644
|
|
31
31
|
tiferet/services/__init__.py,sha256=zB5elAFApNH435JLExPmWxvBmZcCtbAyai-KawUjr4E,101
|
32
32
|
tiferet/services/app.py,sha256=92GvC-Vh8FDZoYMLdgzQ3iS1TVL4uyIErk7NJ4rpYPI,1462
|
33
33
|
tiferet/services/container.py,sha256=ISJhkiNLV--nHbAv6Ajd3ug1cGiyazZoePJOCJu5n_s,1130
|
34
|
-
tiferet-1.0.
|
35
|
-
tiferet-1.0.
|
36
|
-
tiferet-1.0.
|
37
|
-
tiferet-1.0.
|
38
|
-
tiferet-1.0.
|
34
|
+
tiferet-1.0.0a13.dist-info/LICENSE,sha256=e8_GutFM0sxbRlgUaeVsGvJ5uE-KvruLApOzIoHy_zU,1513
|
35
|
+
tiferet-1.0.0a13.dist-info/METADATA,sha256=BYfB1FjgAaGADSuDhktzftuuxLGCr2Z6kGAyldRBLrA,536
|
36
|
+
tiferet-1.0.0a13.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
37
|
+
tiferet-1.0.0a13.dist-info/top_level.txt,sha256=g19Qw0j_VxPw-fgPF1TMPwbtHjnEhNQs0fa69wJZ6IM,8
|
38
|
+
tiferet-1.0.0a13.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|