chore: remove unecessary check in HandleExitCoder function and streamline logic (#1646)

* rm unecessary check and streamline logic

Signed-off-by: zhaque44 <haque.zubair@gmail.com>

* rm else and addressing PR comments

Signed-off-by: zhaque44 <haque.zubair@gmail.com>

---------

Signed-off-by: zhaque44 <haque.zubair@gmail.com>
This commit is contained in:
Zubair Haque 2024-07-27 23:34:27 -04:00 committed by GitHub
parent 522945707a
commit 8f44f12f07
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 4 deletions

View File

@ -84,14 +84,13 @@ func HandleExitCoder(err error) {
}
if exitErr, ok := err.(ExitCoder); ok {
if err.Error() != "" {
fmt.Fprintln(ErrWriter, err)
if errMsg := err.Error(); errMsg != "" {
fmt.Fprintln(ErrWriter, errMsg)
}
OsExiter(exitErr.ExitCode())
return
}
// unknown error exit with code 3
fmt.Fprintln(ErrWriter, err)
fmt.Fprintln(ErrWriter, err)
OsExiter(3)
}