mirror of
https://github.com/tenox7/wrp.git
synced 2024-10-31 21:07:41 +00:00
chromedp.run error handling
This commit is contained in:
parent
0ae49044c2
commit
416490289d
8
wrp.go
8
wrp.go
@ -106,7 +106,7 @@ func capture(gourl string, w int64, h int64, s float64, y int64, out http.Respon
|
||||
log.Printf("Processing Caputure Request for %s\n", gourl)
|
||||
|
||||
// Run ChromeDP Magic
|
||||
chromedp.Run(ctx,
|
||||
err := chromedp.Run(ctx,
|
||||
emulation.SetDeviceMetricsOverride(w, h, s, false),
|
||||
chromedp.Navigate(gourl),
|
||||
chromedp.Evaluate(fmt.Sprintf("window.scrollTo(0, %d);", y), &res),
|
||||
@ -115,6 +115,12 @@ func capture(gourl string, w int64, h int64, s float64, y int64, out http.Respon
|
||||
chromedp.Location(&loc),
|
||||
chromedp.Nodes("a", &nodes, chromedp.ByQueryAll))
|
||||
|
||||
if err != nil {
|
||||
log.Printf("%s", err)
|
||||
fmt.Fprintf(out, "<BR>%s<BR>", err)
|
||||
return
|
||||
}
|
||||
|
||||
log.Printf("Landed on: %s, Nodes: %d\n", loc, len(nodes))
|
||||
|
||||
// Process Screenshot Image
|
||||
|
Loading…
Reference in New Issue
Block a user