diff --git a/Client.go b/Client.go index d41e410..fadd33b 100644 --- a/Client.go +++ b/Client.go @@ -33,6 +33,7 @@ type SearchResultsClient struct { Page int ApiKey string Endpoint string + LastError error } const defaultEndpoint = "https://leakix.net" @@ -45,12 +46,13 @@ func (sc *SearchResultsClient) GetEndpoint() string { } func (sc *SearchResultsClient) Next() bool { + var results []SearchResult if len(sc.SearchResults) > sc.Position { sc.Position++ return true } // Try to load next page - results, _ := sc.GetSearchResults(sc.Scope, sc.Query, sc.Page) + results, sc.LastError = sc.GetSearchResults(sc.Scope, sc.Query, sc.Page) for _, result := range results { sc.SearchResults = append(sc.SearchResults, result) } diff --git a/cmd/leakix/main.go b/cmd/leakix/main.go index 14bedfe..9c80f35 100644 --- a/cmd/leakix/main.go +++ b/cmd/leakix/main.go @@ -71,6 +71,9 @@ func Search() { os.Exit(0) } } + if searcher.LastError != nil { + log.Println("finished with errors: " + searcher.LastError.Error()) + } } func LiveStream() {