Skip to content

Log WebView render errors in MarkdownRenderer#23

Open
jim-daf wants to merge 1 commit into
Tiim:mainfrom
jim-daf:log-webview-render-errors
Open

Log WebView render errors in MarkdownRenderer#23
jim-daf wants to merge 1 commit into
Tiim:mainfrom
jim-daf:log-webview-render-errors

Conversation

@jim-daf
Copy link
Copy Markdown

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

Closes #22

What this does

Adds an onReceivedError(view, request, error) override to the WebViewClient in app/src/main/java/ch/tiim/markdown_widget/MarkdownRenderer.kt. The override logs the error code, description and failing URL through Log.w(TAG, ...), and is filtered to main-frame requests so that off-host subresources referenced inside rendered markdown do not flood logcat.

No behavior change in the happy path, no new dependencies.

Why

onPageFinished fires regardless of whether the render succeeded. The bitmap then gets drawn from a partially loaded WebView and the widget surface shows a blank or half-rendered tile with nothing in logcat. With this hook in place there is at least a concrete error code and failing URL to look at when a tile renders empty.

API level note

The new API 23+ (WebView, WebResourceRequest, WebResourceError) signature is used because the module's minSdk is 24.

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.

MarkdownRenderer WebView swallows render errors silently

1 participant