Skip to content

Commit

Permalink
chore: add wrapping to errors
Browse files Browse the repository at this point in the history
addressing pr comments.
  • Loading branch information
ricardomaraschini committed Oct 15, 2024
1 parent 1fa2eba commit 85ac17c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion pkg/supportbundle/defaultspec/embed.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package defaultspec
import (
_ "embed"

"github.com/pkg/errors"
troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2"
"github.com/replicatedhq/troubleshoot/pkg/supportbundle"
)
Expand All @@ -17,7 +18,7 @@ func Get(isAirgap bool) (troubleshootv1beta2.SupportBundle, error) {
var err error
spec, err = supportbundle.ParseSupportBundle(raw, !isAirgap)
if err != nil {
return troubleshootv1beta2.SupportBundle{}, err
return troubleshootv1beta2.SupportBundle{}, errors.Wrap(err, "failed to parse support bundle")
}
}
return *spec.DeepCopy(), nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/supportbundle/spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ func deduplicatedAfterCollection(supportBundle *troubleshootv1beta2.SupportBundl
func getDefaultAnalyzers(isKurl, isAirgap bool) ([]*troubleshootv1beta2.Analyze, error) {
defaultSpec, err := defaultspec.Get(isAirgap)
if err != nil {
return nil, err
return nil, errors.Wrap(err, "failed to get default spec")
}

defaultAnalyzers := defaultSpec.Spec.Analyzers
Expand Down
2 changes: 1 addition & 1 deletion pkg/supportbundle/supportbundle.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ func CreateSupportBundleAnalysis(appID string, archivePath string, bundle *types

defaultAnalyzers, err := getDefaultAnalyzers(isKurl, foundApp.IsAirgap)
if err != nil {
return err
return errors.Wrap(err, "failed to get default analyzers")
}
analyzer.Spec.Analyzers = append(analyzer.Spec.Analyzers, defaultAnalyzers...)
analyzer.Spec.Analyzers = append(analyzer.Spec.Analyzers, getDefaultDynamicAnalyzers(foundApp)...)
Expand Down

0 comments on commit 85ac17c

Please sign in to comment.