foobara 0.0.23 → 0.0.24
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2 -1
- data/projects/command/src/concerns/errors_type.rb +17 -29
- data/projects/common/src/error.rb +2 -2
- data/projects/value/src/data_error.rb +2 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 53375c9393cbdf5594959c3233650f0cd08b78fc2bf3a07863debcdf12c4f2d9
|
4
|
+
data.tar.gz: 388d748e47be7c602bd79661f1265ecb276b290f067e7c8114231d8a8cb5319f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ce8fdd0b10b5ab7935c8f41dd461be81bbcd9805ead1c81619abafb4f169bf8e38c592818da7f0a0969fde1da214ba7f718e78d70e042b3279facf4224d8c30
|
7
|
+
data.tar.gz: 72beca35aa357bb745d2fdf61b910d8aeba8f51d7fd897e1f94cba02191a41cdacf1c08ff38085da8f094d6e8bf56629bd4a607fc7a1b49ff38d162c6a7c0a5f
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
## [0.0.
|
1
|
+
## [0.0.24] - 2024-12-03
|
2
2
|
|
3
|
+
- Allow passing all Error subclass parameters into possible_*error calls
|
3
4
|
- Allow creating entity types from declaration without model_module
|
4
5
|
- Make model classes with an mutable of false have instances that default to immutable
|
5
6
|
|
@@ -41,8 +41,13 @@ module Foobara
|
|
41
41
|
# :nocov:
|
42
42
|
end
|
43
43
|
when 2
|
44
|
-
symbol,
|
45
|
-
|
44
|
+
symbol, subclass_parameters, data = args
|
45
|
+
|
46
|
+
error_class = Foobara::RuntimeError.subclass(
|
47
|
+
**subclass_parameters,
|
48
|
+
symbol:
|
49
|
+
)
|
50
|
+
|
46
51
|
PossibleError.new(error_class, symbol:, data:)
|
47
52
|
else
|
48
53
|
# :nocov:
|
@@ -56,20 +61,18 @@ module Foobara
|
|
56
61
|
def possible_input_error(
|
57
62
|
path,
|
58
63
|
symbol_or_error_class,
|
59
|
-
|
64
|
+
error_class_or_subclass_parameters = {},
|
60
65
|
data = nil
|
61
66
|
)
|
62
|
-
error_class
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
]
|
72
|
-
end
|
67
|
+
error_class = if symbol_or_error_class.is_a?(Class)
|
68
|
+
symbol_or_error_class
|
69
|
+
else
|
70
|
+
Foobara::DataError.subclass(
|
71
|
+
**error_class_or_subclass_parameters, symbol: symbol_or_error_class
|
72
|
+
)
|
73
|
+
end
|
74
|
+
|
75
|
+
symbol = error_class.symbol
|
73
76
|
|
74
77
|
possible_error = PossibleError.new(error_class, symbol:, data:)
|
75
78
|
possible_error.prepend_path!(path)
|
@@ -102,21 +105,6 @@ module Foobara
|
|
102
105
|
key = possible_error.key.to_s
|
103
106
|
error_context_type_map.delete(key)
|
104
107
|
end
|
105
|
-
|
106
|
-
# TODO: should we cache these???
|
107
|
-
def to_input_error_class(symbol, context_type_declaration)
|
108
|
-
Foobara::Value::DataError.subclass(
|
109
|
-
symbol:,
|
110
|
-
context_type_declaration:
|
111
|
-
)
|
112
|
-
end
|
113
|
-
|
114
|
-
def to_runtime_error_class(symbol, context_type_declaration)
|
115
|
-
Foobara::RuntimeError.subclass(
|
116
|
-
symbol:,
|
117
|
-
context_type_declaration:
|
118
|
-
)
|
119
|
-
end
|
120
108
|
end
|
121
109
|
end
|
122
110
|
end
|
@@ -93,7 +93,7 @@ module Foobara
|
|
93
93
|
|
94
94
|
def subclass(
|
95
95
|
# TODO: technically context_type_declaration doesn't belong here. But maybe it should.
|
96
|
-
|
96
|
+
context: {},
|
97
97
|
name: nil,
|
98
98
|
symbol: nil,
|
99
99
|
message: nil,
|
@@ -120,7 +120,7 @@ module Foobara
|
|
120
120
|
end
|
121
121
|
|
122
122
|
singleton_class.define_method :context_type_declaration do
|
123
|
-
|
123
|
+
context
|
124
124
|
end
|
125
125
|
|
126
126
|
if message
|