Skip to content

Commit 7584e54

Browse files
committed
Clean-up errors
1 parent b2fef75 commit 7584e54

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

pkg/cmd/openshift-tests/run/command.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ package run
22

33
import (
44
"context"
5-
"fmt"
65

76
"github.com/openshift-eng/openshift-tests-extension/pkg/extension"
7+
"github.com/pkg/errors"
88
"github.com/spf13/cobra"
99
"k8s.io/cli-runtime/pkg/genericclioptions"
1010
"k8s.io/kubectl/pkg/util/templates"
@@ -38,20 +38,18 @@ func NewRunCommand(streams genericclioptions.IOStreams, internalExtension *exten
3838
RunE: func(cmd *cobra.Command, args []string) error {
3939
allSuites, err := testsuites.AllTestSuites(context.Background())
4040
if err != nil {
41-
panic(err) // TODO fix me
41+
return errors.WithMessage(err, "couldn't retrieve test suites")
4242
}
4343

4444
o, err := f.ToOptions(args, allSuites, internalExtension)
4545
if err != nil {
46-
fmt.Fprintf(f.IOStreams.ErrOut, "error converting to options: %v", err)
47-
return err
46+
return errors.WithMessage(err, "error converting to options")
4847
}
4948

5049
ctx, cancel := context.WithCancel(context.Background())
5150
defer cancel()
5251
if err := o.Run(ctx); err != nil {
53-
fmt.Fprintf(f.IOStreams.ErrOut, "error running options: %v", err)
54-
return err
52+
return errors.WithMessage(err, "error running a test suite")
5553
}
5654
return nil
5755
},

0 commit comments

Comments
 (0)