diff --git a/plugins/parsers/nagios/parser.go b/plugins/parsers/nagios/parser.go index 6ae03b97a..f45e07a82 100644 --- a/plugins/parsers/nagios/parser.go +++ b/plugins/parsers/nagios/parser.go @@ -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) diff --git a/plugins/parsers/nagios/parser_test.go b/plugins/parsers/nagios/parser_test.go index 63284e218..48cfce241 100644 --- a/plugins/parsers/nagios/parser_test.go +++ b/plugins/parsers/nagios/parser_test.go @@ -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"), }, } @@ -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())