diff --git a/app/src/main/java/com/futo/platformplayer/UIDialogs.kt b/app/src/main/java/com/futo/platformplayer/UIDialogs.kt index 8034854d..1d7e3ef7 100644 --- a/app/src/main/java/com/futo/platformplayer/UIDialogs.kt +++ b/app/src/main/java/com/futo/platformplayer/UIDialogs.kt @@ -319,7 +319,11 @@ class UIDialogs { closeAction?.invoke() }, UIDialogs.ActionStyle.NONE), UIDialogs.Action(context.getString(R.string.retry), { - retryAction?.invoke(); + try { + retryAction?.invoke(); + } catch (e: Throwable) { + Logger.e(TAG, "Unhandled exception retrying", e) + } }, UIDialogs.ActionStyle.PRIMARY) ); else @@ -333,7 +337,11 @@ class UIDialogs { closeAction?.invoke() }, UIDialogs.ActionStyle.NONE), UIDialogs.Action(context.getString(R.string.retry), { - retryAction?.invoke(); + try { + retryAction?.invoke(); + } catch (e: Throwable) { + Logger.e(TAG, "Unhandled exception retrying", e) + } }, UIDialogs.ActionStyle.PRIMARY) ); } diff --git a/app/src/main/java/com/futo/platformplayer/constructs/TaskHandler.kt b/app/src/main/java/com/futo/platformplayer/constructs/TaskHandler.kt index b590fe6e..d3457077 100644 --- a/app/src/main/java/com/futo/platformplayer/constructs/TaskHandler.kt +++ b/app/src/main/java/com/futo/platformplayer/constructs/TaskHandler.kt @@ -82,7 +82,11 @@ class TaskHandler { handled = true; } catch (e: Throwable) { Logger.w(TAG, "Handled exception in TaskHandler onSuccess.", e); - onError.emit(e, parameter); + try { + onError.emit(e, parameter); + } catch (e: Throwable) { + Logger.e(TAG, "Unhandled exception in .exception handler 1", e) + } handled = true; } } @@ -99,10 +103,14 @@ class TaskHandler { if (id != _idGenerator) return@withContext; - if (!onError.emit(e, parameter)) { - Logger.e(TAG, "Uncaught exception handled by TaskHandler.", e); - } else { - //Logger.w(TAG, "Handled exception in TaskHandler invoke.", e); (Prevents duplicate logs) + try { + if (!onError.emit(e, parameter)) { + Logger.e(TAG, "Uncaught exception handled by TaskHandler.", e); + } else { + //Logger.w(TAG, "Handled exception in TaskHandler invoke.", e); (Prevents duplicate logs) + } + } catch (e: Throwable) { + Logger.e(TAG, "Unhandled exception in .exception handler 2", e) } } } diff --git a/app/src/main/java/com/futo/platformplayer/fragment/mainactivity/main/VideoDetailView.kt b/app/src/main/java/com/futo/platformplayer/fragment/mainactivity/main/VideoDetailView.kt index 50e3a730..4692219c 100644 --- a/app/src/main/java/com/futo/platformplayer/fragment/mainactivity/main/VideoDetailView.kt +++ b/app/src/main/java/com/futo/platformplayer/fragment/mainactivity/main/VideoDetailView.kt @@ -619,6 +619,7 @@ class VideoDetailView : ConstraintLayout { loadCurrentVideo(lastPositionMilliseconds); updatePillButtonVisibilities(); setCastEnabled(false); + } else -> {} }