From 5312f7d97c65828f79fcf2c96e4da8b59fdd0bd7 Mon Sep 17 00:00:00 2001 From: manisha kumari Date: Tue, 26 Mar 2024 13:09:58 +0530 Subject: [PATCH] Error handling with incorrect argument --- main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index b277497..e6b0b5b 100644 --- a/main.go +++ b/main.go @@ -314,8 +314,8 @@ func checkArgs(event *corev2.Event) (int, error) { if _, err := os.Stat(plugin.StateDir); errors.Is(err, os.ErrNotExist) { err := os.Mkdir(plugin.StateDir, os.ModePerm) if err != nil { - //err = fmt.Errorf("selected --state-directory %s does not exist and cannot be created.Expected a correct Path to create/reach the directory.", plugin.StateDir) - //fmt.Println(err.Error()) + err = fmt.Errorf("selected --state-directory %s does not exist and cannot be created.Expected a correct Path to create/reach the directory.", plugin.StateDir) + fmt.Println(err.Error()) //return sensu.CheckStateCritical, nil logrus.Exit(sensu.CheckStateCritical) return sensu.CheckStateCritical, fmt.Errorf("selected --state-directory %s does not exist and cannot be created.Expected a correct Path to create/reach the directory ", plugin.StateDir)