mirror of
https://codeberg.org/scip/esctl.git
synced 2026-08-24 14:34:18 +02:00
go fix'd
This commit is contained in:
@@ -18,6 +18,7 @@ package es
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/elastic/go-elasticsearch/v9/typedapi/types"
|
||||
)
|
||||
@@ -27,14 +28,14 @@ func esErrorString(err error) string {
|
||||
|
||||
switch e := err.(type) {
|
||||
case *types.ElasticsearchError:
|
||||
causes := ""
|
||||
var causes strings.Builder
|
||||
|
||||
for _, cause := range e.ErrorCause.RootCause {
|
||||
causes += fmt.Sprintf("%s\n", *cause.Reason)
|
||||
causes.WriteString(fmt.Sprintf("%s\n", *cause.Reason))
|
||||
}
|
||||
|
||||
if e.ErrorCause.Reason != nil {
|
||||
msg = *e.ErrorCause.Reason + ": " + causes
|
||||
msg = *e.ErrorCause.Reason + ": " + causes.String()
|
||||
} else {
|
||||
msg = fmt.Sprintf("http status %d: ", e.Status)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user