From f35d91933bd3f1ef1255a6f46d82bdfa185fb3ed Mon Sep 17 00:00:00 2001 From: earthor1 Date: Sun, 8 Feb 2026 12:34:12 -0500 Subject: [PATCH] Core: Throw OptionError for option type Toggle in certain scenarios (#5874) * Throw OptionError for option type Toggle in certain scenarios * Adding missing space to Options.py Co-authored-by: Katelyn Gigante --------- Co-authored-by: Katelyn Gigante --- Options.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Options.py b/Options.py index 13f776455c..c9518df6c6 100644 --- a/Options.py +++ b/Options.py @@ -417,10 +417,12 @@ class Toggle(NumericOption): def from_text(cls, text: str) -> Toggle: if text == "random": return cls(random.choice(list(cls.name_lookup))) - elif text.lower() in {"off", "0", "false", "none", "null", "no"}: + elif text.lower() in {"off", "0", "false", "none", "null", "no", "disabled"}: return cls(0) - else: + elif text.lower() in {"on", "1", "true", "yes", "enabled"}: return cls(1) + else: + raise OptionError(f"Option {cls.__name__} does not support a value of {text}") @classmethod def from_any(cls, data: typing.Any):