From ad322b331499c5d36334afb4577ee5c86848c460 Mon Sep 17 00:00:00 2001 From: Christopher Angelo Phillips <32073428+spiffcs@users.noreply.github.com> Date: Thu, 3 Mar 2022 10:37:18 -0500 Subject: [PATCH] bump error language and remove panic (#862) * bump error language and remove panic Signed-off-by: Christopher Phillips --- cmd/attest.go | 2 +- cmd/packages.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/attest.go b/cmd/attest.go index c05fcf389..9be6b1d5c 100644 --- a/cmd/attest.go +++ b/cmd/attest.go @@ -125,7 +125,7 @@ func attestExec(ctx context.Context, _ *cobra.Command, args []string) error { userInput := args[0] si, err := source.ParseInput(userInput, false) if err != nil { - return fmt.Errorf("could not generate source input for attest command: %q", err) + return fmt.Errorf("could not generate source input for attest command: %w", err) } switch si.Scheme { diff --git a/cmd/packages.go b/cmd/packages.go index 1666f3c7c..a16a14b96 100644 --- a/cmd/packages.go +++ b/cmd/packages.go @@ -231,7 +231,7 @@ func packagesExec(_ *cobra.Command, args []string) error { userInput := args[0] si, err := source.ParseInput(userInput, true) if err != nil { - return fmt.Errorf("could not generate source input for attest command: %q", err) + return fmt.Errorf("could not generate source input for packages command: %w", err) } return eventLoop( @@ -306,7 +306,7 @@ func packagesExecWorker(si source.Input, writer sbom.Writer) <-chan error { } if s == nil { - panic("nil sbomb returned with no error") + errs <- fmt.Errorf("no SBOM produced for %q", si.UserInput) } if appConfig.Anchore.Host != "" {