bug: DuckDuckGo searchPage.GetResults() cannot report errors #6
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Parent: #1
Description
In
sites/duckduckgo/page.go:20-57,GetResults()callss.doc.ForEach()but the error is stored in a local variable and never returned. The method signature isGetResults() []Result— it has no error return value.This means any ForEach errors during pagination or "Load More" are silently swallowed.
Fix
Change signature to
GetResults() ([]Result, error)and return the error. This is a breaking API change for theSearchPageinterface.Starting work on this as part of PR 4 (also includes #5). Will update
SearchPage.GetResults()to return([]Result, error)so theForEacherror is no longer silently discarded.Work finished. PR: #35
Changed
SearchPage.GetResults()to return([]Result, error)and propagate theForEacherror.Resolved by PR #35 —
GetResults()now returns([]Result, error)andSearch()properly propagates errors.