mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-22 00:35:34 +00:00
Fix: Handle ValueError when converting plane names
This commit is contained in:
parent
2e4ea37ca6
commit
80429efe72
@ -67,14 +67,14 @@ class MapPlane(Keyword):
|
||||
try:
|
||||
_ = self.floors[floor - 1]
|
||||
return floor
|
||||
except IndexError:
|
||||
except (IndexError, ValueError):
|
||||
raise ScriptError(f'Plane {self} does not have floor index {floor}')
|
||||
elif isinstance(floor, str):
|
||||
# Convert to floor index
|
||||
floor = floor.upper()
|
||||
try:
|
||||
return self.floors.index(floor) + 1
|
||||
except IndexError:
|
||||
except (IndexError, ValueError):
|
||||
raise ScriptError(f'Plane {self} does not have floor name {floor}')
|
||||
else:
|
||||
raise ScriptError(f'Plane {self} does not have floor {floor}')
|
||||
@ -95,7 +95,7 @@ class MapPlane(Keyword):
|
||||
# Convert to floor index
|
||||
try:
|
||||
return self.floors[floor - 1]
|
||||
except IndexError:
|
||||
except (IndexError, ValueError):
|
||||
raise ScriptError(f'Plane {self} does not have floor index {floor}')
|
||||
elif isinstance(floor, str):
|
||||
# Check exist
|
||||
@ -103,7 +103,7 @@ class MapPlane(Keyword):
|
||||
try:
|
||||
_ = self.floors.index(floor) + 1
|
||||
return floor
|
||||
except IndexError:
|
||||
except (IndexError, ValueError):
|
||||
raise ScriptError(f'Plane {self} does not have floor name {floor}')
|
||||
else:
|
||||
raise ScriptError(f'Plane {self} does not have floor {floor}')
|
||||
|
Loading…
Reference in New Issue
Block a user