fix(webview): replace log.Fatal with Core error handling in doc + code (#712)
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:
parent
1a0e322150
commit
e646d42cf7
1 changed files with 21 additions and 10 deletions
31
webview.go
31
webview.go
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue