Skip to content

Commit 56ae109

Browse files
committed
Add a new message to the array
1 parent 040b0c7 commit 56ae109

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

json_config_file/json_properties/json_property.gd

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ const MESSAGE_ENUM_NOT_VALID = "'%s' is not in the list of valid values"
110110
const MESSAGE_ARRAY_SMALLER_THAN_MIN = "The array size (%d) is smaller than the minimum allowed (%d)"
111111
const MESSAGE_ARRAY_BIGGER_THAN_MAX = "The array size (%d) is bigger than the maximum allowed (%d)"
112112
const MESSAGE_ARRAY_TWO_ELEMENTS_ARE_EQUAL = "The array contains two elements that are equal: [%d] and [%d]"
113+
const MESSAGE_ARRAY_TWO_KEYS_ARE_EQUAL = "The array contains two objects with the same '%s': [%d] and [%d]"
113114
const MESSAGE_COLOR_WRONG_SIZE = "The color is %d element(s) long, when it should be 3 to 4"
114115
const MESSAGE_COLOR_WRONG_TYPE = "Wrong type: expected 'integer' in the range [0, 255]"
115116
const MESSAGE_COLOR_OUT_OF_RANGE = "%d is out of the range [0, 255]"
@@ -178,7 +179,10 @@ static func _error_as_text(error: Dictionary) -> String:
178179
Errors.ARRAY_BIGGER_THAN_MAX:
179180
error_as_text = MESSAGE_ARRAY_BIGGER_THAN_MAX % [error.size, error.max]
180181
Errors.ARRAY_TWO_ELEMENTS_ARE_EQUAL:
181-
error_as_text = MESSAGE_ARRAY_TWO_ELEMENTS_ARE_EQUAL % [error.element_1, error.element_2]
182+
if error.has("key"):
183+
error_as_text = MESSAGE_ARRAY_TWO_KEYS_ARE_EQUAL % [error.key, error.element_1, error.element_2]
184+
else:
185+
error_as_text = MESSAGE_ARRAY_TWO_ELEMENTS_ARE_EQUAL % [error.element_1, error.element_2]
182186
Errors.COLOR_WRONG_SIZE:
183187
error_as_text = MESSAGE_COLOR_WRONG_SIZE % error.size
184188
Errors.COLOR_WRONG_TYPE:

0 commit comments

Comments
 (0)