From dd5824f4365b01e3c501d8b5cda914dff138e03d Mon Sep 17 00:00:00 2001 From: Matthis Holleville Date: Tue, 11 Apr 2023 19:20:49 +0200 Subject: [PATCH] feat: return errors if filter specified by flag does not exist. Signed-off-by: Matthis Holleville --- pkg/analysis/analysis.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/analysis/analysis.go b/pkg/analysis/analysis.go index 6dd54b6ecb..c9c1697a38 100644 --- a/pkg/analysis/analysis.go +++ b/pkg/analysis/analysis.go @@ -3,6 +3,7 @@ package analysis import ( "context" "encoding/json" + "errors" "fmt" "strings" @@ -72,6 +73,8 @@ func (a *Analysis) RunAnalysis() error { return err } a.Results = append(a.Results, results...) + } else { + return errors.New(fmt.Sprintf("\"%s\" filter does not exist. Please run k8sgpt filters list.", filter)) } } return nil