-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Connection Errors
Oliver Eilhard edited this page May 6, 2017
·
1 revision
Starting from 5.0.37, we use github.com/pkg/errors
to wrap errors. This enhances error messages as it no longer hides the underlying problem, but concatenates the error with the "wrapped" error.
Unfortunately, an equality check for a specific error might now fail. The most common situation you are looking for is to check for a connection error. Do not try to compare err == elastic.ErrNoClient
. Instead, use the IsConnErr
helper which you can use like so:
if elastic.IsConnErr(err) {
log.Fatalf("Elasticsearch connection problem: %v", err)
}