mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-04 12:59:23 +08:00
fcf0887d92
Signed-off-by: godchen0212 <qingxiang.chen@zilliz.com>
28 lines
538 B
Go
28 lines
538 B
Go
package errorutil
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
)
|
|
|
|
// ErrorList for print error log
|
|
type ErrorList []error
|
|
|
|
// Error method return an string representation of retry error list.
|
|
func (el ErrorList) Error() string {
|
|
limit := 10
|
|
var builder strings.Builder
|
|
builder.WriteString("All attempts results:\n")
|
|
for index, err := range el {
|
|
// if early termination happens
|
|
if err == nil {
|
|
break
|
|
}
|
|
if index > limit {
|
|
break
|
|
}
|
|
builder.WriteString(fmt.Sprintf("attempt #%d:%s\n", index+1, err.Error()))
|
|
}
|
|
return builder.String()
|
|
}
|