Skip to content

Commit

Permalink
Error handling that identifies issues with user data
Browse files Browse the repository at this point in the history
  • Loading branch information
BHM03 committed Dec 16, 2024
1 parent 00ed1da commit 5ca2b2b
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions fightme_webapp/lib/training_area_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,15 @@ class TrainingAreaPageState extends State<TrainingAreaPage> {
children: [
ElevatedButton(
onPressed: () {
showDialog<String>(
context: context,
builder: (BuildContext context) =>
FightButton(game: FightGameSession.practice(widget.curUser))
);
try {
showDialog<String>(
context: context,
builder: (BuildContext context) => FightButton(game: FightGameSession.practice(widget.curUser))
);
} catch (e) {
final snackBar = SnackBar(content: Text('Failed to start practice session: ${e.toString()}'));
ScaffoldMessenger.of(context).showSnackBar(snackBar);
}
},
child: const Text('Practice against a dummy')),
ElevatedButton(
Expand Down

0 comments on commit 5ca2b2b

Please sign in to comment.