mirror of
https://codeberg.org/scip/esctl.git
synced 2026-08-24 14:24:20 +02:00
satisfy full linter
This commit is contained in:
@@ -27,22 +27,20 @@ import (
|
||||
func esErrorString(err error) error {
|
||||
msg := err.Error()
|
||||
|
||||
switch e := err.(type) {
|
||||
//nolint:gocritic
|
||||
switch errVal := err.(type) {
|
||||
case *types.ElasticsearchError:
|
||||
var causes strings.Builder
|
||||
|
||||
for _, cause := range e.ErrorCause.RootCause {
|
||||
// FIXME: re-activate linter here, see https://github.com/golangci/golangci-lint/issues/6662
|
||||
//nolint:staticcheck
|
||||
causes.WriteString(fmt.Sprintf("%s\n", *cause.Reason))
|
||||
for _, cause := range errVal.ErrorCause.RootCause {
|
||||
fmt.Fprintf(&causes, "%s\n", *cause.Reason)
|
||||
}
|
||||
|
||||
if e.ErrorCause.Reason != nil {
|
||||
msg = *e.ErrorCause.Reason + ": " + causes.String()
|
||||
if errVal.ErrorCause.Reason != nil {
|
||||
msg = *errVal.ErrorCause.Reason + ": " + causes.String()
|
||||
} else {
|
||||
msg = fmt.Sprintf("http status %d: ", e.Status)
|
||||
msg = fmt.Sprintf("http status %d: ", errVal.Status)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return errors.New(msg)
|
||||
|
||||
Reference in New Issue
Block a user