Skip to content

Commit 91d3b0a

Browse files
Merge pull request steam-bell-92#1374 from DeepeshKafalatiya/feature/standardize-exception-handling
refactor: standardize exception handling in word_building.py
2 parents a7ee1f3 + 91278f0 commit 91d3b0a

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)