Options: loudly crash if random text is not recognized, instead of de… (#401)
* Options: loudly crash if random text is not recognized, instead of defaulting to full "random" * Update Options.py Co-authored-by: Hussein Farran <hmfarran@gmail.com> Co-authored-by: Hussein Farran <hmfarran@gmail.com>
This commit is contained in:
parent
a3e1ac896f
commit
ed1c11267c
|
@ -256,8 +256,10 @@ class Range(Option[int], int):
|
|||
return cls(int(round(random.triangular(random_range[0], random_range[1], random_range[1]))))
|
||||
else:
|
||||
return cls(int(round(random.randint(random_range[0], random_range[1]))))
|
||||
else:
|
||||
elif text == "random":
|
||||
return cls(random.randint(cls.range_start, cls.range_end))
|
||||
else:
|
||||
raise Exception(f"random text \"{text}\" did not resolve to a recognized pattern. Acceptable values are: random, random-high, random-middle, random-low, random-range-low-<min>-<max>, random-range-middle-<min>-<max>, random-range-high-<min>-<max>, or random-range-<min>-<max>.")
|
||||
return cls(int(text))
|
||||
|
||||
@classmethod
|
||||
|
|
Loading…
Reference in New Issue