Log response status code to help debug

Recently, the crawler job often fails after 10+ hours with the following
error (10.0.47.27:9200 is the ElasticSearch master):
dial tcp 10.0.47.27:9200: connect: connection refused
This commit is contained in:
Haiyan Meng
2020-01-10 11:37:22 -08:00
parent f9a4d5a14e
commit c801958d40

View File

@@ -87,7 +87,7 @@ func (idx *index) responseErrorOrNil(info string, res *esapi.Response,
defer res.Body.Close()
if res.IsError() {
return fmt.Errorf("%s: %s", messageStart, res.String())
return fmt.Errorf("%s: %s [%d]", messageStart, res.String(), res.StatusCode)
}
if reader != nil {