In sites/duckduckgo/page.go:20-57, GetResults() calls s.doc.ForEach() but the error is stored in a local variable and never returned. The method signature is GetResults() []Result — it has no error return value.
func(ssearchPage)GetResults()[]Result{varres[]Resultvarerrerrorerr=s.doc.ForEach(`article[id^="r1-"]`,func(nextractor.Node)error{// ... extraction ...})returnres// err is silently discarded}
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 the SearchPage interface.
**Parent:** #1
## Description
In `sites/duckduckgo/page.go:20-57`, `GetResults()` calls `s.doc.ForEach()` but the error is stored in a local variable and never returned. The method signature is `GetResults() []Result` — it has no error return value.
```go
func (s searchPage) GetResults() []Result {
var res []Result
var err error
err = s.doc.ForEach(`article[id^="r1-"]`, func(n extractor.Node) error {
// ... extraction ...
})
return res // err is silently discarded
}
```
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 the `SearchPage` interface.
Starting work on this as part of PR 4 (also includes #5). Will update SearchPage.GetResults() to return ([]Result, error) so the ForEach error is no longer silently discarded.
Starting work on this as part of PR 4 (also includes #5). Will update `SearchPage.GetResults()` to return `([]Result, error)` so the `ForEach` error is no longer silently discarded.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
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.