Skip to content

Commit

Permalink
Error handling with incorrect argument in state-dir
Browse files Browse the repository at this point in the history
  • Loading branch information
ManishaKumari295 committed Mar 26, 2024
1 parent 5312f7d commit ec1d37c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,11 +314,11 @@ 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)
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)
//return sensu.CheckStateCritical, nil
//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)
}
}
if _, err := os.Stat(plugin.StateDir); err != nil {
Expand Down

0 comments on commit ec1d37c

Please sign in to comment.