Add try-catch to video store
This commit is contained in:
parent
98fabafbdb
commit
268f8427d6
2 changed files with 5 additions and 3 deletions
|
|
@ -227,7 +227,7 @@ class TwitchApi {
|
|||
if (data.isNotEmpty) {
|
||||
return StreamTwitch.fromJson(data.first);
|
||||
} else {
|
||||
throw Exception('User is offline or does not exist.');
|
||||
throw Exception('$userLogin is offline');
|
||||
}
|
||||
} else {
|
||||
throw Exception('Failed to get stream info.');
|
||||
|
|
|
|||
|
|
@ -72,9 +72,11 @@ abstract class _VideoStoreBase with Store {
|
|||
|
||||
@action
|
||||
Future<void> updateStreamInfo() async {
|
||||
final updatedStreamInfo = await twitchApi.getStream(userLogin: userLogin, headers: authStore.headersTwitch);
|
||||
if (updatedStreamInfo != null) {
|
||||
try {
|
||||
final updatedStreamInfo = await twitchApi.getStream(userLogin: userLogin, headers: authStore.headersTwitch);
|
||||
_streamInfo = updatedStreamInfo;
|
||||
} catch (e) {
|
||||
debugPrint(e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue