From b2c5eaed549ab1d2b0beded57b666dcccc25ba38 Mon Sep 17 00:00:00 2001 From: Yuriy Liskov Date: Tue, 8 Jul 2025 02:12:58 +0300 Subject: [PATCH] media service manager: improve error handling --- .../common/misc/MediaServiceManager.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/misc/MediaServiceManager.java b/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/misc/MediaServiceManager.java index 031925a57..86eb38620 100644 --- a/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/misc/MediaServiceManager.java +++ b/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/misc/MediaServiceManager.java @@ -202,6 +202,10 @@ public class MediaServiceManager implements OnAccountChange { } public void loadChannelRows(Video item, OnMediaGroupList onMediaGroupList) { + loadChannelRows(item, onMediaGroupList, null); + } + + public void loadChannelRows(Video item, OnMediaGroupList onMediaGroupList, OnError onError) { if (item == null) { return; } @@ -214,7 +218,12 @@ public class MediaServiceManager implements OnAccountChange { mRowsAction = observable .subscribe( onMediaGroupList::onMediaGroupList, - error -> Log.e(TAG, "loadChannelRows error: %s", error.getMessage()) + error -> { + Log.e(TAG, "loadChannelRows error: %s", error.getMessage()); + if (onError != null) { + onError.onError(error); + } + } ); } @@ -500,6 +509,6 @@ public class MediaServiceManager implements OnAccountChange { } else { MessageHelpers.showMessage(context, "Unknown type of channel"); } - }); + }, error -> LoadingManager.showLoading(context, false)); } }