feat: add trackings get error code

This commit is contained in:
lilong.129
2023-09-13 19:06:31 +08:00
parent 460d4329f6
commit f1fa87c912
2 changed files with 19 additions and 9 deletions

View File

@@ -78,16 +78,21 @@ var (
MobileUIAssertForegroundAppError = errors.New("mobile UI assert foreground app error") // 76
MobileUIAssertForegroundActivityError = errors.New("mobile UI assert foreground activity error") // 77
MobileUIPopupError = errors.New("mobile UI popup error") // 78
LoopActionNotFoundError = errors.New("loop action not found error") // 79
)
// CV related: [80, 90)
var (
CVEnvMissedError = errors.New("CV env missed error") // 80
CVRequestError = errors.New("CV prepare request error") // 81
CVServiceConnectionError = errors.New("CV service connect error") // 82
CVResponseError = errors.New("CV parse response error") // 83
CVResultNotFoundError = errors.New("CV result not found") // 84
LoopActionNotFoundError = errors.New("loop action not found error") // 85
CVEnvMissedError = errors.New("CV env missed error") // 80
CVRequestError = errors.New("CV prepare request error") // 81
CVServiceConnectionError = errors.New("CV service connect error") // 82
CVResponseError = errors.New("CV parse response error") // 83
CVResultNotFoundError = errors.New("CV result not found") // 84
)
// trackings related: [90, 100)
var (
TrackingGetError = errors.New("get trackings failed") // 90
)
var errorsMap = map[error]int{
@@ -141,6 +146,7 @@ var errorsMap = map[error]int{
MobileUIAssertForegroundAppError: 76,
MobileUIAssertForegroundActivityError: 77,
MobileUIPopupError: 78,
LoopActionNotFoundError: 79,
// OCR related
CVEnvMissedError: 80,
@@ -148,7 +154,9 @@ var errorsMap = map[error]int{
CVServiceConnectionError: 82,
CVResponseError: 83,
CVResultNotFoundError: 84,
LoopActionNotFoundError: 85,
// trackings related
TrackingGetError: 90,
}
func IsErrorPredefined(err error) bool {

View File

@@ -162,7 +162,8 @@ func (vc *VideoCrawler) startLiveCrawler(enterPoint PointF) error {
if err != nil || liveRoom.Type != VideoType_Live {
if vc.failedCount >= 3 {
// failed 3 consecutive times
return errors.New("get current live event trackings failed 3 consecutive times")
return errors.Wrap(code.TrackingGetError,
"get current live event trackings failed 3 consecutive times")
}
log.Warn().Int64("failedCount", vc.failedCount).
Msg("get current live room failed")
@@ -265,7 +266,8 @@ func (dExt *DriverExt) VideoCrawler(configs *VideoCrawlerConfigs) (err error) {
if err != nil || feedVideo.Type == "" {
if crawler.failedCount >= 10 {
// failed 10 consecutive times
return errors.New("get current feed video failed 10 consecutive times")
return errors.Wrap(code.TrackingGetError,
"get current feed video failed 10 consecutive times")
}
log.Warn().Msg("get current feed video failed")