未验证 提交 684632d9 编写于 作者: H huanggze

refine es error format

Signed-off-by: Nhuanggze <loganhuang@yunify.com>
上级 90961a24
......@@ -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
......
......@@ -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"])
}
}
......@@ -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"])
}
}
......@@ -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"])
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册