diff --git a/core/app.py b/core/app.py index 4ac6e00..d0f7fea 100644 --- a/core/app.py +++ b/core/app.py @@ -380,19 +380,23 @@ class Main: for option in self.options: if name == option.name: - self._print("option §B--§r%s§/ already exists" %(name), prefix.fail, exc=GeneralError) + self._print("option §B--§r%s§/ already exists" %(name), prefix.fail) + raise RuntimeError if option.short_name and short_name == option.short_name: - self._print("option §B--§r%s§/'s short name §r%s§/ is already taken by §B--§y%s§/" %(name, short_name, option.name), prefix.fail, exc=GeneralError) + self._print("option §B--§r%s§/'s short name §r%s§/ is already taken by §B--§y%s§/" %(name, short_name, option.name), prefix.fail) + raise RuntimeError if short_name and len(short_name) > 1: - self._print("short name must be a single character; option §B--§r%s§/ has §r%s§/"%(name, short_name), prefix.fail, exc=GeneralError) + self._print("short name must be a single character; option §B--§r%s§/ has §r%s§/"%(name, short_name), prefix.fail) + raise RuntimeError if callback: use_cfg_file = False if dtype not in ["bool", "str", "int", "float"]: - self._print("option §B--§r%s§/'s dtype is not of a supported type" %(name), prefix.fail, exc=GeneralError) + self._print("option §B--§r%s§/'s dtype is not of a supported type" %(name), prefix.fail) + raise RuntimeError v = _verify_type(default, dtype, plural) @@ -405,7 +409,8 @@ class Main: else: type_desc = "a %s" %(dtype) - self._print("option §B--§r%s§/'s default must be §y%s§/" %(name, type_desc), prefix.fail, exc=GeneralError) + self._print("option §B--§r%s§/'s default must be §y%s§/" %(name, type_desc), prefix.fail) + raise RuntimeError o = Option(name, dtype, default, description, short_name, plural, use_cfg_file, callback, hidden) self.options.append(o) @@ -478,13 +483,15 @@ class Main: o.value = bool_on else: if not bool_on: - self._print("§B--no-§r%s§/ makes no sense because this option is of type §y%s§/" %(name, o.dtype), prefix.fail, exc=GeneralError) + self._print("§B--no-§r%s§/ makes no sense because this option is of type §y%s§/" %(name, o.dtype), prefix.fail) + raise RuntimeError # This option takes arguments. These are all words at ptr and higher that don't begin with "--". # If this option is part of a shortgroup it must be at its end. if to_parse.index(w) + 1 != len(to_parse): - self._print("option §B{0[0]}§r{1.short_name}§/ needs to be at the end of group §y{0}§/".format(word, o), prefix.fail, exc=GeneralError) + self._print("option §B{0[0]}§r{1.short_name}§/ needs to be at the end of group §y{0}§/".format(word, o), prefix.fail) + raise RuntimeError got_something = False