fix(webview): replace log.Fatal with Core error handling in doc + code (#712)
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run

Package doc example in webview.go now uses run() error pattern, wraps
failures with core.E(), prints to stderr via core.Print, exits from
main with os.Exit(1). No real log.Fatal call sites existed in
webview.go (doc-only fix). Build + race tests green.

Co-authored-by: Codex <noreply@openai.com>
Closes tasks.lthn.sh/view.php?id=712
This commit is contained in:
Snider 2026-04-25 06:04:29 +01:00
parent 1a0e322150
commit e646d42cf7

View file

@ -7,18 +7,29 @@
//
// Example usage:
//
// wv, err := webview.New(webview.WithDebugURL("http://localhost:9222"))
// if err != nil {
// log.Fatal(err)
// }
// defer wv.Close()
//
// if err := wv.Navigate("https://example.com"); err != nil {
// log.Fatal(err)
// func main() {
// if err := run(); err != nil {
// core.Print(os.Stderr, "webview example: %v", err)
// os.Exit(1)
// }
// }
//
// if err := wv.Click("#submit-button"); err != nil {
// log.Fatal(err)
// func run() error {
// wv, err := webview.New(webview.WithDebugURL("http://localhost:9222"))
// if err != nil {
// return core.E("webview.example", "create webview", err)
// }
// defer wv.Close()
//
// if err := wv.Navigate("https://example.com"); err != nil {
// return core.E("webview.example", "navigate", err)
// }
//
// if err := wv.Click("#submit-button"); err != nil {
// return core.E("webview.example", "click submit button", err)
// }
//
// return nil
// }
package webview