Skip to content

Commit

Permalink
fix(parsers.nagios): nagios parser now uses real error for logging in…
Browse files Browse the repository at this point in the history
  • Loading branch information
Sakerdotes authored Jan 20, 2022
1 parent 61214bd commit 83ab2b8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion plugins/parsers/nagios/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func getExitCode(err error) (int, error) {
// If it is not an *exec.ExitError, then it must be
// an io error, but docs do not say anything about the
// exit code in this case.
return 0, errors.New("expected *exec.ExitError")
return 0, err
}

ws, ok := ee.Sys().(syscall.WaitStatus)
Expand Down
4 changes: 2 additions & 2 deletions plugins/parsers/nagios/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func TestGetExitCode(t *testing.T) {
return errors.New("I am not *exec.ExitError")
},
expCode: 0,
expErr: errors.New("expected *exec.ExitError"),
expErr: errors.New("I am not *exec.ExitError"),
},
}

Expand Down Expand Up @@ -177,7 +177,7 @@ func TestTryAddState(t *testing.T) {
n("nagios").
f("perfdata", 0).b(),
}
expErr := "exec: get exit code: expected *exec.ExitError"
expErr := "exec: get exit code: non parsable error"

assertEqual(t, exp, metrics)
require.Equal(t, expErr, err.Error())
Expand Down

0 comments on commit 83ab2b8

Please sign in to comment.