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-28 11:34:27 +08:00
committed by GitHub
parent 522945707a
commit 8f44f12f07
+3 -4
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)
}