diff --git a/lib/features/iptv/services/xtream_service_mobile.dart b/lib/features/iptv/services/xtream_service_mobile.dart index 0d9e121..a8ede25 100644 --- a/lib/features/iptv/services/xtream_service_mobile.dart +++ b/lib/features/iptv/services/xtream_service_mobile.dart @@ -161,6 +161,11 @@ class XtreamServiceMobile { options: _getOptions(), ); + if (response.data is! Map) { + if (response.data is String) + throw Exception('Auth Error: ${response.data}'); + throw Exception('Invalid auth response format'); + } return response.data as Map; } catch (e) { throw Exception('Authentication failed: $e'); @@ -182,7 +187,11 @@ class XtreamServiceMobile { options: _getOptions(), ); - if (response.data is! List) return {}; + if (response.data is! List) { + if (response.data is String) + throw Exception('Category Error: ${response.data}'); + return {}; + } final List categories = response.data as List; final Map categoryMap = {}; @@ -219,7 +228,11 @@ class XtreamServiceMobile { options: _getOptions(), ); - if (response.data is! List) return {}; + if (response.data is! List) { + if (response.data is String) + throw Exception('Live TV Error: ${response.data}'); + return {}; + } final List streams = response.data as List; final Map> groupedChannels = {}; @@ -332,6 +345,8 @@ class XtreamServiceMobile { ); if (response.data is! List) { + if (response.data is String) + throw Exception('VOD Error: ${response.data}'); _cachedMoviesRaw = []; } else { _cachedMoviesRaw = response.data as List; @@ -424,6 +439,8 @@ class XtreamServiceMobile { ); if (response.data is! List) { + if (response.data is String) + throw Exception('Series Error: ${response.data}'); _cachedSeriesRaw = []; } else { _cachedSeriesRaw = response.data as List;