Skip to content

Commit

Permalink
Add err handling to page.on(console)
Browse files Browse the repository at this point in the history
Mainly useful for debugging purposes, but otherwise this isn't really
needed except to ensure we exit asap from the for loop when the
context has ended and therefore the iteration has ended.
  • Loading branch information
ankur22 committed Oct 18, 2024
1 parent f0e7319 commit 4b4b690
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion common/page.go
Original file line number Diff line number Diff line change
Expand Up @@ -527,9 +527,13 @@ func (p *Page) onConsoleAPICalled(event *cdpruntime.EventConsoleAPICalled) {
p.eventHandlersMu.RLock()
defer p.eventHandlersMu.RUnlock()
for _, h := range p.eventHandlers[EventPageConsoleAPICalled] {
h(PageOnEvent{
err := h(PageOnEvent{
ConsoleMessage: m,
})
if err != nil {
p.logger.Debugf("onConsoleAPICalled", "handler returned an error: %v", err)
return
}
}
}

Expand Down

0 comments on commit 4b4b690

Please sign in to comment.