Skip to content

Commit

Permalink
Error handling with incorrect argument
Browse files Browse the repository at this point in the history
  • Loading branch information
ManishaKumari295 committed Mar 26, 2024
1 parent b0dbe01 commit 5312f7d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Check failure on line 317 in main.go

View workflow job for this annotation

GitHub Actions / staticcheck (project)

error strings should not end with punctuation or newlines (ST1005)
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)
Expand Down

0 comments on commit 5312f7d

Please sign in to comment.