Merge "Remove AirshipError"
This commit is contained in:
commit
bfa6344335
@ -60,7 +60,7 @@ func (c *RepoCheckout) Validate() error {
|
|||||||
return ErrMutuallyExclusiveCheckout{}
|
return ErrMutuallyExclusiveCheckout{}
|
||||||
}
|
}
|
||||||
if c.RemoteRef != "" {
|
if c.RemoteRef != "" {
|
||||||
return fmt.Errorf("Repository checkout by RemoteRef is not yet implemented\n%w", errors.ErrNotImplemented{})
|
return errors.ErrNotImplemented{What: "repository checkout by RemoteRef"}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -163,7 +163,7 @@ func (repo *Repository) ToAuth() (transport.AuthMethod, error) {
|
|||||||
case HTTPBasic:
|
case HTTPBasic:
|
||||||
return &http.BasicAuth{Username: repo.Auth.Username, Password: repo.Auth.HTTPPassword}, nil
|
return &http.BasicAuth{Username: repo.Auth.Username, Password: repo.Auth.HTTPPassword}, nil
|
||||||
default:
|
default:
|
||||||
return nil, fmt.Errorf("Error building auth opts, repo\n%s\n: %w", repo.String(), errors.ErrNotImplemented{})
|
return nil, errors.ErrNotImplemented{What: fmt.Sprintf("authtype %s", repo.Auth.Type)}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,23 +14,16 @@
|
|||||||
|
|
||||||
package errors
|
package errors
|
||||||
|
|
||||||
// AirshipError is the base error type
|
import "fmt"
|
||||||
// used to create extended error types
|
|
||||||
// in other airshipctl packages.
|
|
||||||
type AirshipError struct {
|
|
||||||
Message string
|
|
||||||
}
|
|
||||||
|
|
||||||
// Error function implements the golang
|
// ErrNotImplemented returned for features not yet implemented
|
||||||
// error interface
|
|
||||||
func (ae *AirshipError) Error() string {
|
|
||||||
return ae.Message
|
|
||||||
}
|
|
||||||
|
|
||||||
// ErrNotImplemented returned for not implemented features
|
|
||||||
type ErrNotImplemented struct {
|
type ErrNotImplemented struct {
|
||||||
|
What string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e ErrNotImplemented) Error() string {
|
func (e ErrNotImplemented) Error() string {
|
||||||
return "Not implemented"
|
if e.What != "" {
|
||||||
|
return fmt.Sprintf("not implemented: %s", e.What)
|
||||||
|
}
|
||||||
|
return "not implemented"
|
||||||
}
|
}
|
||||||
|
@ -16,8 +16,6 @@ package remote
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
aerror "opendev.org/airship/airshipctl/pkg/errors"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// TODO: This need to be refactored to match the error format used elsewhere in airshipctl
|
// TODO: This need to be refactored to match the error format used elsewhere in airshipctl
|
||||||
@ -25,20 +23,21 @@ import (
|
|||||||
|
|
||||||
// GenericError provides general feedback about an error that occurred in a remote operation
|
// GenericError provides general feedback about an error that occurred in a remote operation
|
||||||
type GenericError struct {
|
type GenericError struct {
|
||||||
aerror.AirshipError
|
Message string
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewRemoteDirectErrorf retruns formatted remote direct errors
|
// NewRemoteDirectErrorf retruns formatted remote direct errors
|
||||||
func NewRemoteDirectErrorf(format string, v ...interface{}) error {
|
func NewRemoteDirectErrorf(format string, v ...interface{}) error {
|
||||||
e := &GenericError{}
|
return &GenericError{Message: fmt.Sprintf(format, v...)}
|
||||||
e.Message = fmt.Sprintf(format, v...)
|
}
|
||||||
return e
|
|
||||||
|
func (e GenericError) Error() string {
|
||||||
|
return e.Message
|
||||||
}
|
}
|
||||||
|
|
||||||
// ErrUnknownManagementType is an error that indicates the remote type specified in the airshipctl management
|
// ErrUnknownManagementType is an error that indicates the remote type specified in the airshipctl management
|
||||||
// configuration (e.g. redfish, redfish-dell) is not supported.
|
// configuration (e.g. redfish, redfish-dell) is not supported.
|
||||||
type ErrUnknownManagementType struct {
|
type ErrUnknownManagementType struct {
|
||||||
aerror.AirshipError
|
|
||||||
Type string
|
Type string
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,7 +48,6 @@ func (e ErrUnknownManagementType) Error() string {
|
|||||||
// ErrMissingBootstrapInfoOption is an error that indicates a bootstrap option is missing in the airshipctl
|
// ErrMissingBootstrapInfoOption is an error that indicates a bootstrap option is missing in the airshipctl
|
||||||
// bootstrapInfo configuration.
|
// bootstrapInfo configuration.
|
||||||
type ErrMissingBootstrapInfoOption struct {
|
type ErrMissingBootstrapInfoOption struct {
|
||||||
aerror.AirshipError
|
|
||||||
What string
|
What string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,13 +16,10 @@ package redfish
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
aerror "opendev.org/airship/airshipctl/pkg/errors"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// ErrRedfishClient describes an error encountered by the go-redfish client.
|
// ErrRedfishClient describes an error encountered by the go-redfish client.
|
||||||
type ErrRedfishClient struct {
|
type ErrRedfishClient struct {
|
||||||
aerror.AirshipError
|
|
||||||
Message string
|
Message string
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,7 +48,6 @@ func (e ErrOperationRetriesExceeded) Error() string {
|
|||||||
|
|
||||||
// ErrUnrecognizedRedfishResponse is a debug error that describes unexpected formats in a Redfish error response.
|
// ErrUnrecognizedRedfishResponse is a debug error that describes unexpected formats in a Redfish error response.
|
||||||
type ErrUnrecognizedRedfishResponse struct {
|
type ErrUnrecognizedRedfishResponse struct {
|
||||||
aerror.AirshipError
|
|
||||||
Key string
|
Key string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user