api.go
changeset 240 80c81e9b77b4
parent 239 ca5639b4768e
child 243 7386c6a454a8
--- a/api.go	Thu Sep 06 11:28:42 2018 +0200
+++ b/api.go	Thu Sep 06 11:43:44 2018 +0200
@@ -130,7 +130,10 @@
 		return nil, err
 	}
 	if res.StatusCode < 200 || res.StatusCode >= 300 {
-		return nil, errors.Errorf("bad server status code (%d): %s",
+		// Please note that the error string code is used by Search()
+		// to check the error cause.
+		const errFormatString = "bad server status code (%d)"
+		return nil, errors.Errorf(errFormatString+": %s",
 			res.StatusCode, http.StatusText(res.StatusCode))
 	}