From c801958d40746dd29ee5e2404a875424ed2cbd73 Mon Sep 17 00:00:00 2001 From: Haiyan Meng Date: Fri, 10 Jan 2020 11:37:22 -0800 Subject: [PATCH] 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 --- api/internal/crawl/index/elasticsearch.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/internal/crawl/index/elasticsearch.go b/api/internal/crawl/index/elasticsearch.go index 3226b4970..7d7ce2b9e 100644 --- a/api/internal/crawl/index/elasticsearch.go +++ b/api/internal/crawl/index/elasticsearch.go @@ -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 {