Refine error handling behavior
so that exit 1 happens as long as error is non-nil
This commit is contained in:
parent
8ae5b3d5e2
commit
e9688813e4
@ -5,6 +5,7 @@
|
|||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
### Added
|
### Added
|
||||||
- Flag type code generation via `go generate`
|
- Flag type code generation via `go generate`
|
||||||
|
- Write to stderr and exit 1 if action returns non-nil error
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- Raise minimum tested/supported Go version to 1.2+
|
- Raise minimum tested/supported Go version to 1.2+
|
||||||
|
@ -93,6 +93,6 @@ func HandleExitCoder(err error) {
|
|||||||
|
|
||||||
if err.Error() != "" {
|
if err.Error() != "" {
|
||||||
fmt.Fprintln(ErrWriter, err)
|
fmt.Fprintln(ErrWriter, err)
|
||||||
OsExiter(1)
|
|
||||||
}
|
}
|
||||||
|
OsExiter(1)
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,7 @@ func TestHandleExitCoder_ErrorWithoutMessage(t *testing.T) {
|
|||||||
err := errors.New("")
|
err := errors.New("")
|
||||||
HandleExitCoder(err)
|
HandleExitCoder(err)
|
||||||
|
|
||||||
expect(t, exitCode, 0)
|
expect(t, exitCode, 1)
|
||||||
expect(t, called, false)
|
expect(t, called, true)
|
||||||
expect(t, ErrWriter.(*bytes.Buffer).String(), "")
|
expect(t, ErrWriter.(*bytes.Buffer).String(), "")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user