/
githubmirror
/
origin
Обзор
Документация
Войти
/
githubmirror
/
origin
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
vendor/github.com/vmware/govmomi/find/error.go
52 строки
1 KB
Justin Pierce
Add compat_otp package with openshift-tests-private (OTP) util implementations
11 авг 2025, 18:00
11 авг 2025, 18:00
80ac5c1
Код
Авторство
О чём код?
// © Broadcom. All Rights Reserved. // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. // SPDX-License-Identifier: Apache-2.0 package find import "fmt" type NotFoundError struct { kind string path string } func (e *NotFoundError) Error() string { return fmt.Sprintf("%s '%s' not found", e.kind, e.path) } type MultipleFoundError struct { kind string path string } func (e *MultipleFoundError) Error() string { return fmt.Sprintf("path '%s' resolves to multiple %ss", e.path, e.kind) } type DefaultNotFoundError struct { kind string } func (e *DefaultNotFoundError) Error() string { return fmt.Sprintf("no default %s found", e.kind) } type DefaultMultipleFoundError struct { kind string } func (e DefaultMultipleFoundError) Error() string { return fmt.Sprintf("default %s resolves to multiple instances, please specify", e.kind) } func toDefaultError(err error) error { switch e := err.(type) { case *NotFoundError: return &DefaultNotFoundError{e.kind} case *MultipleFoundError: return &DefaultMultipleFoundError{e.kind} default: return err } }