From b2b536bd58dddab94bd9de048e3feef415cde3d3 Mon Sep 17 00:00:00 2001 From: Ankur Date: Thu, 11 Jan 2024 11:47:06 +0000 Subject: [PATCH] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: İnanç Gümüş --- common/element_handle.go | 4 ++-- common/frame_manager.go | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/common/element_handle.go b/common/element_handle.go index 763c3f623..e6bf201f7 100644 --- a/common/element_handle.go +++ b/common/element_handle.go @@ -768,7 +768,7 @@ func (h *ElementHandle) ContentFrame() (*Frame, error) { frame, found := h.frame.manager.getFrameByID(node.FrameID) if !found { - return nil, fmt.Errorf("frame not found for id") + return nil, fmt.Errorf("frame not found for id %s", node.FrameID) } return frame, nil @@ -1010,7 +1010,7 @@ func (h *ElementHandle) OwnerFrame() (*Frame, error) { frame, found := h.frame.manager.getFrameByID(node.FrameID) if !found { - return nil, fmt.Errorf("no frame found for id") + return nil, fmt.Errorf("no frame found for id %s", node.FrameID) } return frame, nil diff --git a/common/frame_manager.go b/common/frame_manager.go index c4d3dc455..17321b01c 100644 --- a/common/frame_manager.go +++ b/common/frame_manager.go @@ -390,9 +390,8 @@ func (m *FrameManager) frameRequestedNavigation(frameID cdp.FrameID, url string, return nil } -// getFrameByID will attempt to find a frame with the given id. If one is found -// the frame and true will be returned. If one isn't found nil and false will -// be returned. +// getFrameByID finds a frame with id. If found, it returns the frame and true, +// otherwise, it returns nil and false. func (m *FrameManager) getFrameByID(id cdp.FrameID) (*Frame, bool) { m.framesMu.RLock() defer m.framesMu.RUnlock()