Skip to content

fix(stream): log main-frame WebView load errors via onReceivedError#1134

Merged
flex3r merged 2 commits into
flex3r:developfrom
jim-daf:fix-stream-onreceivederror
Jul 10, 2026
Merged

fix(stream): log main-frame WebView load errors via onReceivedError#1134
flex3r merged 2 commits into
flex3r:developfrom
jim-daf:fix-stream-onreceivederror

Conversation

@jim-daf

@jim-daf jim-daf commented May 15, 2026

Copy link
Copy Markdown
Contributor

Closes #1133.

The two stream-overlay WebViewClients in ui/main/stream/ (StreamWebView.kt and StreamView.kt) override shouldOverrideUrlLoading (plus onPageFinished on the Compose one) but neither overrides onReceivedError. When the embed fails to load (network drop, DNS, the player URL moves), the WebView just stays blank with nothing in the log to point at.

Add a main-frame-only onReceivedError override on both clients that logs the failing URL and description through the existing KotlinLogging.logger(...) used elsewhere in the codebase:

override fun onReceivedError(
    view: WebView?,
    request: WebResourceRequest?,
    error: WebResourceError?,
) {
    super.onReceivedError(view, request, error)
    if (request?.isForMainFrame != true) return
    val description = if (Build.VERSION.SDK_INT >= 23) {
        error?.description?.toString().orEmpty()
    } else {
        ""
    }
    logger.warn { "Stream WebView failed to load ${request.url}: $description" }
}

isForMainFrame gate keeps blocked sub-resources from spamming the log on every embed. No UX change: the overlay still does the same thing on success, but stream playback failures now leave a trace.

@flex3r flex3r left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to add some logging, just two nitpicks

Comment thread app/src/main/kotlin/com/flxrs/dankchat/ui/main/stream/StreamView.kt Outdated
Comment thread app/src/main/kotlin/com/flxrs/dankchat/ui/main/stream/StreamWebView.kt Outdated
@jim-daf jim-daf force-pushed the fix-stream-onreceivederror branch from b094a9f to a0894ef Compare June 11, 2026 10:30
@jim-daf

jim-daf commented Jun 11, 2026

Copy link
Copy Markdown
Contributor Author

Makes sense to add some logging, just two nitpicks

Done. @flex3r I put the logging you requested. You can check if everything is okay and let me know

@jim-daf jim-daf requested a review from flex3r June 11, 2026 10:33
@flex3r

flex3r commented Jun 11, 2026

Copy link
Copy Markdown
Owner

Seems like the linter is not happy with the import order. Running ./gradlew spotlessApply should fix it.

jim-daf added 2 commits July 9, 2026 10:21
Both stream-overlay WebViewClient blocks (StreamWebView and the
Compose-side StreamComposeWebViewClient in StreamView) override
shouldOverrideUrlLoading but not onReceivedError. When the Twitch
embed URL fails to load the overlay stays blank with nothing in
the log to debug from.

Add a main-frame-only onReceivedError override on both clients that
warns through the existing KotlinLogging.logger(...) used elsewhere
in the codebase. The isForMainFrame gate keeps blocked sub-resources
from spamming the log on every embed.
@jim-daf jim-daf force-pushed the fix-stream-onreceivederror branch from ee96d57 to cf20502 Compare July 9, 2026 08:22
@jim-daf

jim-daf commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

Seems like the linter is not happy with the import order. Running ./gradlew spotlessApply should fix it.

@flex3r i fixed the import order and also rebased so there are no conflicts with your develop branch

@flex3r flex3r merged commit f362613 into flex3r:develop Jul 10, 2026
4 checks passed
@flex3r

flex3r commented Jul 10, 2026

Copy link
Copy Markdown
Owner

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stream WebViewClients have no onReceivedError, so playback failures leave nothing in the log

2 participants