Skip to content

Commit

Permalink
Core: Add new error message for item count when defined as a set inst…
Browse files Browse the repository at this point in the history
…ead 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]>
  • Loading branch information
3 people authored Dec 1, 2024
1 parent 21dbfd2 commit 1a5d22c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Options.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 1a5d22c

Please sign in to comment.