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