removed results loging + added logs for no results returned where missing + improved image fetching
This commit is contained in:
parent
a138928d63
commit
87ac6f05f9
5 changed files with 19 additions and 14 deletions
|
@ -34,10 +34,6 @@ func PerformLibreXTextSearch(query, safe, lang string, page int) ([]TextSearchRe
|
|||
return nil, 0, err
|
||||
}
|
||||
|
||||
if debugMode {
|
||||
log.Println("Generated User Agent (text):", userAgent)
|
||||
}
|
||||
|
||||
req, err := http.NewRequest("GET", searchURL, nil)
|
||||
if err != nil {
|
||||
return nil, 0, err
|
||||
|
@ -74,9 +70,14 @@ func PerformLibreXTextSearch(query, safe, lang string, page int) ([]TextSearchRe
|
|||
|
||||
duration := time.Since(startTime) // Calculate the duration
|
||||
|
||||
if len(results) == 0 {
|
||||
return nil, duration, fmt.Errorf("no results found")
|
||||
}
|
||||
|
||||
return results, duration, nil
|
||||
}
|
||||
|
||||
// This is just stupid it will probbably lead to printing error twice
|
||||
func logError(message string, err error) error {
|
||||
log.Printf("%s: %v", message, err)
|
||||
return fmt.Errorf("%s: %w", message, err)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue