Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[mobile][photos][cast] add error handling to case where fetching of active sessions in cast sheet fails

Priyanshu Dangareaeac4f6b9fa0
diff --git a/mobile/apps/photos/lib/ui/cast/cast.dart b/mobile/apps/photos/lib/ui/cast/cast.dart
index 257233264d..95495103db 100644
--- a/mobile/apps/photos/lib/ui/cast/cast.dart
+++ b/mobile/apps/photos/lib/ui/cast/cast.dart
@@ -1,6 +1,7 @@
import "package:ente_components/ente_components.dart";
import "package:flutter/widgets.dart";
import "package:hugeicons/hugeicons.dart";
+import "package:logging/logging.dart";
import "package:photos/core/network/network.dart";
import "package:photos/gateways/cast/cast_gateway.dart";
import "package:photos/generated/l10n.dart";
@@ -10,13 +11,22 @@ import "package:photos/theme/ente_theme.dart";
import "package:photos/ui/cast/pair_with_auto.dart";
import "package:photos/ui/cast/pair_with_code.dart";
import "package:photos/ui/settings/cast/cast_settings_page.dart";
+import "package:photos/utils/dialog_util.dart";
Future<void> showCastSheet(BuildContext context, Collection collection) async {
final l10n = AppLocalizations.of(context);
final textStyle = getEnteTextTheme(context);
await castService.closeActiveCasts();
final gw = CastGateway(NetworkClient.instance.enteDio);
- final sessions = await gw.getAllCastSessions();
+ final logger = Logger("showCastSheet");
+ late final List<CastInfo> sessions;
+ try {
+ sessions = await gw.getAllCastSessions();
+ } catch (e, s) {
+ logger.severe('Failed to fetch active sessions in cast sheet: ', e, s);
+ await showGenericErrorDialog(context: context, error: e);
+ return;
+ }
return showBottomSheetComponent(
context: context,
builder: (_) => BottomSheetComponent(