mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-01-16 01:51:06 -05:00
Bumps [github.com/gookit/config/v2](https://github.com/gookit/config) from 2.2.4 to 2.2.5. - [Release notes](https://github.com/gookit/config/releases) - [Commits](https://github.com/gookit/config/compare/v2.2.4...v2.2.5) --- updated-dependencies: - dependency-name: github.com/gookit/config/v2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
39 lines
554 B
Go
39 lines
554 B
Go
package comdef
|
|
|
|
import (
|
|
"errors"
|
|
"strings"
|
|
)
|
|
|
|
// ErrConvType error
|
|
var ErrConvType = errors.New("convert value type error")
|
|
|
|
// Errors multi error list
|
|
type Errors []error
|
|
|
|
// Error string
|
|
func (es Errors) Error() string {
|
|
var sb strings.Builder
|
|
for _, err := range es {
|
|
sb.WriteString(err.Error())
|
|
sb.WriteByte('\n')
|
|
}
|
|
return sb.String()
|
|
}
|
|
|
|
// ErrOrNil error
|
|
func (es Errors) ErrOrNil() error {
|
|
if len(es) == 0 {
|
|
return nil
|
|
}
|
|
return es
|
|
}
|
|
|
|
// First error
|
|
func (es Errors) First() error {
|
|
if len(es) > 0 {
|
|
return es[0]
|
|
}
|
|
return nil
|
|
}
|