Skip to content

Commit

Permalink
Remove deprecated Error* aliases
Browse files Browse the repository at this point in the history
It is not used anymore, and it fixes a linting error.

Signed-off-by: Vincent Demeester <vdemeest@redhat.com>
  • Loading branch information
vdemeester authored and tekton-robot committed Nov 12, 2024
1 parent 8c6647b commit fbaca91
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 93 deletions.
14 changes: 2 additions & 12 deletions cmd/entrypoint/subcommands/subcommands.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,8 @@ func (err OK) Error() string {
return err.message
}

// SubcommandSuccessful is an alias for the OK type.
//
// Deprecated: replace usage with OK type.
type SubcommandSuccessful = OK

var (
// Compile-time check that OK is an error type.
_ error = OK{}
// Compile-time check that objects of type OK are cast to deprecated
// SubcommandSuccessful type.
_ SubcommandSuccessful = OK{}
)
// Compile-time check that OK is an error type.
var _ error = OK{}

// SubcommandError is returned for failed subcommand executions.
type SubcommandError struct {
Expand Down
16 changes: 4 additions & 12 deletions pkg/remote/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,7 @@ package remote

import "errors"

var (
// ErrRequestInProgress is a sentinel value that indicates
// resolving a remote file like a pipeline in a bundle or
// a task in git hasn't completed yet.
ErrRequestInProgress = errors.New("resource request in progress")

// ErrorRequestInProgress is an alias for ErrRequestInProgress and will be
// removed in a future release..
//
// Deprecated: use ErrRequestInProgress instead
ErrorRequestInProgress = ErrRequestInProgress
)
// ErrRequestInProgress is a sentinel value that indicates
// resolving a remote file like a pipeline in a bundle or
// a task in git hasn't completed yet.
var ErrRequestInProgress = errors.New("resource request in progress")
34 changes: 5 additions & 29 deletions pkg/remote/resolution/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,33 +21,17 @@ import (
"fmt"
)

var (
// ErrNilResource is returned when remote resolution
// appears to have succeeded but the resolved resource is nil.
ErrNilResource = errors.New("unknown error occurred: requested resource is nil")

// ErrorRequestedResourceIsNil is a deprecated alias for ErrNilResource and will
// be removed in a future release.
//
// Deprecated: use ErrNilResource instead.
ErrorRequestedResourceIsNil = ErrNilResource
)
// ErrNilResource is returned when remote resolution
// appears to have succeeded but the resolved resource is nil.
var ErrNilResource = errors.New("unknown error occurred: requested resource is nil")

// InvalidRuntimeObjectError is returned when remote resolution
// succeeded but the returned data is not a valid runtime.Object.
type InvalidRuntimeObjectError struct {
Original error
}

// ErrorInvalidRuntimeObject is an alias to InvalidRuntimeObjectError.
//
// Deprecated: use InvalidRuntimeObjectError instead.
type ErrorInvalidRuntimeObject = InvalidRuntimeObjectError

var (
_ error = &InvalidRuntimeObjectError{}
_ error = &ErrorInvalidRuntimeObject{}
)
var _ error = &InvalidRuntimeObjectError{}

// Error returns the string representation of this error.
func (e *InvalidRuntimeObjectError) Error() string {
Expand All @@ -71,15 +55,7 @@ type DataAccessError struct {
Original error
}

// ErrorAccessingData is an alias to DataAccessError
//
// Deprecated: use DataAccessError instead.
type ErrorAccessingData = DataAccessError

var (
_ error = &DataAccessError{}
_ error = &ErrorAccessingData{}
)
var _ error = &DataAccessError{}

// Error returns the string representation of this error.
func (e *DataAccessError) Error() string {
Expand Down
33 changes: 3 additions & 30 deletions pkg/resolution/common/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,9 @@ func NewError(reason string, err error) *Error {
}
}

var (
// ErrRequestInProgress is a sentinel value to indicate that
// a resource request is still in progress.
ErrRequestInProgress = NewError("RequestInProgress", errors.New("Resource request is still in-progress"))

// ErrorRequestInProgress is an alias to ErrRequestInProgress
//
// Deprecated: use ErrRequestInProgress instead.
ErrorRequestInProgress = ErrRequestInProgress
)
// ErrRequestInProgress is a sentinel value to indicate that
// a resource request is still in progress.
var ErrRequestInProgress = NewError("RequestInProgress", errors.New("Resource request is still in-progress"))

// InvalidResourceKeyError indicates that a string key given to the
// Reconcile function does not match the expected "name" or "namespace/name"
Expand All @@ -80,11 +73,6 @@ type InvalidResourceKeyError struct {
Original error
}

// ErrorInvalidResourceKey is an alias to type InvalidResourceKeyError.
//
// Deprecated: use type InvalidResourceKeyError instead.
type ErrorInvalidResourceKey = InvalidResourceKeyError

var _ error = &InvalidResourceKeyError{}

func (e *InvalidResourceKeyError) Error() string {
Expand All @@ -104,11 +92,6 @@ type InvalidRequestError struct {
Message string
}

// ErrorInvalidRequest is an alias to type InvalidRequestError.
//
// Deprecated: use type InvalidRequestError instead.
type ErrorInvalidRequest = InvalidRequestError

var _ error = &InvalidRequestError{}

func (e *InvalidRequestError) Error() string {
Expand All @@ -123,11 +106,6 @@ type GetResourceError struct {
Original error
}

// ErrorGettingResource is an alias to type GetResourceError.
//
// Deprecated: use type GetResourceError instead.
type ErrorGettingResource = GetResourceError

var _ error = &GetResourceError{}

func (e *GetResourceError) Error() string {
Expand All @@ -146,11 +124,6 @@ type UpdatingRequestError struct {
Original error
}

// ErrorUpdatingRequest is an alias to UpdatingRequestError
//
// Deprecated: use UpdatingRequestError instead.
type ErrorUpdatingRequest = UpdatingRequestError

var _ error = &UpdatingRequestError{}

func (e *UpdatingRequestError) Error() string {
Expand Down
13 changes: 3 additions & 10 deletions pkg/resolution/resolver/framework/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,16 +173,9 @@ func LeaderAwareFuncs(lister rrlister.ResolutionRequestLister) reconciler.Leader
}
}

var (
// ErrMissingTypeSelector is returned when a resolver does not return
// a selector with a type label from its GetSelector method.
ErrMissingTypeSelector = fmt.Errorf("invalid resolver: minimum selector must include %q", common.LabelKeyResolverType)

// ErrorMissingTypeSelector is an alias to ErrMissingTypeSelector
//
// Deprecated: use ErrMissingTypeSelector instead.
ErrorMissingTypeSelector = ErrMissingTypeSelector
)
// ErrMissingTypeSelector is returned when a resolver does not return
// a selector with a type label from its GetSelector method.
var ErrMissingTypeSelector = fmt.Errorf("invalid resolver: minimum selector must include %q", common.LabelKeyResolverType)

func ValidateResolver(ctx context.Context, sel map[string]string) error {
if sel == nil {
Expand Down

0 comments on commit fbaca91

Please sign in to comment.