Core: Add new error message for item count when defined as a set instead of a dict (#4100)

* Core: New error message if item count is a set

* Apply suggestion for error message

Co-authored-by: Exempt-Medic <[email protected]>

* Apply item count error suggestion

Co-authored-by: Nicholas Saylor <[email protected]>

---------

Co-authored-by: Exempt-Medic <[email protected]>
Co-authored-by: Nicholas Saylor <[email protected]>
This commit is contained in:
Benjamin S Wolf
2024-12-01 04:51:26 +01:00
committed by GitHub
co-authored by Exempt-Medic Nicholas Saylor
parent 21dbfd2472
commit 1a5d22ca78
+2
View File
@@ -863,6 +863,8 @@ class ItemDict(OptionDict):
verify_item_name = True
def __init__(self, value: typing.Dict[str, int]):
if any(item_count is None for item_count in value.values()):
raise Exception("Items must have counts associated with them. Please provide positive integer values in the format \"item\": count .")
if any(item_count < 1 for item_count in value.values()):
raise Exception("Cannot have non-positive item counts.")
super(ItemDict, self).__init__(value)