diff --git a/hrp/internal/code/code.go b/hrp/internal/code/code.go index 630f7fa9..887115e3 100644 --- a/hrp/internal/code/code.go +++ b/hrp/internal/code/code.go @@ -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 { diff --git a/hrp/pkg/uixt/video_crawler.go b/hrp/pkg/uixt/video_crawler.go index cecea20a..b1d205c4 100644 --- a/hrp/pkg/uixt/video_crawler.go +++ b/hrp/pkg/uixt/video_crawler.go @@ -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")