Don't swallow error when trying to mark stream as watched

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
Aayush Gupta
2025-12-03 17:19:28 +08:00
parent 5c9ac912ac
commit 4a00dbb15d
2 changed files with 20 additions and 1 deletions

View File

@@ -1230,7 +1230,13 @@ public final class VideoDetailFragment
disposables.add(recordManager.onViewed(info).onErrorComplete() disposables.add(recordManager.onViewed(info).onErrorComplete()
.subscribe( .subscribe(
ignored -> { /* successful */ }, ignored -> { /* successful */ },
error -> Log.e(TAG, "Register view failure: ", error) error -> showSnackBarError(
new ErrorInfo(
error,
UserAction.PLAY_STREAM,
"Got an error when modifying history on viewed"
)
)
)); ));
} }

View File

@@ -13,6 +13,9 @@ import androidx.annotation.StringRes;
import org.schabi.newpipe.R; import org.schabi.newpipe.R;
import org.schabi.newpipe.database.stream.model.StreamEntity; import org.schabi.newpipe.database.stream.model.StreamEntity;
import org.schabi.newpipe.download.DownloadDialog; import org.schabi.newpipe.download.DownloadDialog;
import org.schabi.newpipe.error.ErrorInfo;
import org.schabi.newpipe.error.ErrorUtil;
import org.schabi.newpipe.error.UserAction;
import org.schabi.newpipe.local.dialog.PlaylistAppendDialog; import org.schabi.newpipe.local.dialog.PlaylistAppendDialog;
import org.schabi.newpipe.local.dialog.PlaylistDialog; import org.schabi.newpipe.local.dialog.PlaylistDialog;
import org.schabi.newpipe.local.history.HistoryRecordManager; import org.schabi.newpipe.local.history.HistoryRecordManager;
@@ -132,6 +135,16 @@ public enum StreamDialogDefaultEntry {
MARK_AS_WATCHED(R.string.mark_as_watched, (fragment, item) -> MARK_AS_WATCHED(R.string.mark_as_watched, (fragment, item) ->
new HistoryRecordManager(fragment.getContext()) new HistoryRecordManager(fragment.getContext())
.markAsWatched(item) .markAsWatched(item)
.doOnError(error -> {
ErrorUtil.showSnackbar(
fragment.requireContext(),
new ErrorInfo(
error,
UserAction.OPEN_INFO_ITEM_DIALOG,
"Got an error when trying to mark as watched"
)
);
})
.onErrorComplete() .onErrorComplete()
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe() .subscribe()