mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-14 04:49:41 +08:00
change: print hrp exit code
This commit is contained in:
@@ -2,6 +2,7 @@ package code
|
||||
|
||||
import (
|
||||
"github.com/pkg/errors"
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
// general: [0, 2)
|
||||
@@ -102,15 +103,19 @@ var errorsMap = map[error]int{
|
||||
OCRTextNotFoundError: 84,
|
||||
}
|
||||
|
||||
func GetErrorCode(err error) int {
|
||||
func GetErrorCode(err error) (exitCode int) {
|
||||
if err == nil {
|
||||
log.Info().Int("code", Success).Msg("hrp exit")
|
||||
return Success
|
||||
}
|
||||
|
||||
e := errors.Cause(err)
|
||||
if code, ok := errorsMap[e]; ok {
|
||||
return code
|
||||
exitCode = code
|
||||
} else {
|
||||
exitCode = GeneralFail
|
||||
}
|
||||
|
||||
return GeneralFail
|
||||
log.Warn().Int("code", exitCode).Msg("hrp exit")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
v4.3.0-beta-10211516
|
||||
v4.3.0-beta-10211541
|
||||
@@ -306,8 +306,8 @@ func (dev *IOSDevice) forward(localPort, remotePort int) error {
|
||||
|
||||
rInnerConn, err := device.NewConnect(remotePort)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("connect to device failed")
|
||||
os.Exit(1)
|
||||
log.Error().Err(err).Msg("connect to ios device failed")
|
||||
os.Exit(code.GetErrorCode(code.IOSDeviceConnectionError))
|
||||
}
|
||||
|
||||
rConn := rInnerConn.RawConn()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
__version__ = "v4.3.0-beta-10211516"
|
||||
__version__ = "v4.3.0-beta-10211541"
|
||||
__description__ = "One-stop solution for HTTP(S) testing."
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[tool.poetry]
|
||||
name = "httprunner"
|
||||
version = "v4.3.0-beta-10211516"
|
||||
version = "v4.3.0-beta-10211541"
|
||||
description = "One-stop solution for HTTP(S) testing."
|
||||
license = "Apache-2.0"
|
||||
readme = "README.md"
|
||||
|
||||
Reference in New Issue
Block a user