refactor: raise adb error

This commit is contained in:
lilong.129
2023-06-22 16:33:53 +08:00
parent 0d6da534ab
commit b5612c5632
5 changed files with 62 additions and 41 deletions
+9
View File
@@ -5,7 +5,10 @@ import (
"strconv"
"strings"
"github.com/pkg/errors"
"github.com/rs/zerolog/log"
"github.com/httprunner/httprunner/v4/hrp/internal/code"
)
const (
@@ -84,6 +87,12 @@ func (c Client) DeviceSerialList() (serials []string, err error) {
}
func (c Client) DeviceList() (devices []*Device, err error) {
defer func() {
if err != nil && errors.Cause(err) == nil {
err = errors.Wrap(code.AndroidDeviceConnectionError, err.Error())
}
}()
var resp string
if resp, err = c.executeCommand("host:devices-l"); err != nil {
return