Provide better feedback when declaring max-size without a value

This commit is contained in:
Raffson 2023-07-08 20:35:21 +02:00
parent 6734b80684
commit 737df98988
No known key found for this signature in database
GPG Key ID: B0402B2C9B764D99

View File

@ -39,11 +39,18 @@ class SquadronConfig:
else:
secondary = [FlightType(s) for s in secondary_raw]
max_size = data.get("size", DEFAULT_SQUADRON_SIZE)
if max_size is None:
raise RuntimeError(
"Squadron's size is defined in campaign but is missing a value:\n"
f"{data}"
)
return SquadronConfig(
FlightType(data["primary"]),
secondary,
data.get("aircraft", []),
data.get("size", DEFAULT_SQUADRON_SIZE),
max_size,
data.get("name", None),
data.get("nickname", None),
data.get("female_pilot_percentage", None),