Archipelago icon indicating copy to clipboard operation
Archipelago copied to clipboard

Core: warn if a yaml is empty

Open Zannick opened this issue 1 year ago • 1 comments

What is this fixing or adding?

--- marks the start of a yaml document which lets us put multiple yamls in one file, but if it's accidentally put at the end of the file (or twice in a row or anything), that yaml document will be empty, aka None. This throws an exception that doesn't clearly identify the file:

Uncaught exception
Traceback (most recent call last):
  File "c:\Users\bswolf\Documents\GitHub\Archipelago\Generate.py", line 529, in <module>
    erargs, seed = main()
                   ^^^^^^
  File "c:\Users\bswolf\Documents\GitHub\Archipelago\Generate.py", line 127, in main
    f"{get_choice('description', yaml, 'No description specified')}")
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\bswolf\Documents\GitHub\Archipelago\Generate.py", line 260, in get_choice
    if option not in root:
       ^^^^^^^^^^^^^^^^^^
TypeError: argument of type 'NoneType' is not iterable

Rather than write a new exception to specify the file, we can simply issue a warning and continue:

P72 Weights: Zannick Psy.yaml >> Plain Psychonauts
Ignoring empty yaml block in Zannick Psy.yaml
P73 Weights: Zillion.yaml >> Default Zillion Template

How was this tested?

Manually.

Zannick avatar Oct 29 '24 05:10 Zannick