refine es error format

Signed-off-by: huanggze <loganhuang@yunify.com>
This commit is contained in:
huanggze
2019-10-17 17:23:26 +08:00
parent 90961a24df
commit 684632d9ac
4 changed files with 4 additions and 4 deletions

View File

@@ -117,7 +117,7 @@ func detectVersionMajor(host string) (string, error) {
if res.IsError() {
// Print the response status and error information.
e, _ := b["error"].(map[string]interface{})
return "", fmt.Errorf("[%s] %s: %s", res.Status(), e["type"], e["reason"])
return "", fmt.Errorf("[%s] type: %v, reason: %v", res.Status(), e["type"], e["reason"])
}
// get the major version

View File

@@ -83,6 +83,6 @@ func parseError(response *esapi.Response) error {
} else {
// Print the response status and error information.
e, _ := e["error"].(map[string]interface{})
return fmt.Errorf("%s: %s", e["type"], e["reason"])
return fmt.Errorf("type: %v, reason: %v", e["type"], e["reason"])
}
}

View File

@@ -83,6 +83,6 @@ func parseError(response *esapi.Response) error {
} else {
// Print the response status and error information.
e, _ := e["error"].(map[string]interface{})
return fmt.Errorf("%s: %s", e["type"], e["reason"])
return fmt.Errorf("type: %v, reason: %v", e["type"], e["reason"])
}
}

View File

@@ -86,6 +86,6 @@ func parseError(response *esapi.Response) error {
} else {
// Print the response status and error information.
e, _ := e["error"].(map[string]interface{})
return fmt.Errorf("%s: %s", e["type"], e["reason"])
return fmt.Errorf("type: %v, reason: %v", e["type"], e["reason"])
}
}