Skip to content

Commit 91278f0

Browse files
refactor: standardize exception handling in word_building.py
1 parent a7ee1f3 commit 91278f0

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

games/Word-Building/word_building.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ def botTurn(letter, used_words):
1515
available = [w for w in data.words.get(letter, []) if w not in used_words]
1616
if available:
1717
word = random.choice(available)
18-
except:
19-
pass
18+
except (AttributeError, KeyError) as e:
19+
print(f"⚠️ Warning: Bot encountered a dictionary matching issue: {e}")
2020
return word
2121

2222
def Main():

0 commit comments

Comments
 (0)