From 664a12a207fec475a3f9b24473c2b569ea1fba92 Mon Sep 17 00:00:00 2001 From: "lilong.129" Date: Mon, 5 Jun 2023 20:54:22 +0800 Subject: [PATCH] change: ignore error when get foreground app failed for ios --- hrp/pkg/uixt/video_crawler.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/hrp/pkg/uixt/video_crawler.go b/hrp/pkg/uixt/video_crawler.go index fc0f87ea..9aac58a5 100644 --- a/hrp/pkg/uixt/video_crawler.go +++ b/hrp/pkg/uixt/video_crawler.go @@ -358,7 +358,8 @@ func (dExt *DriverExt) VideoCrawler(configs *VideoCrawlerConfigs) (err error) { } else { app, err := dExt.Driver.GetForegroundApp() if err != nil { - return err + // ignore error when get foreground app failed + log.Warn().Err(err).Msg("get foreground app failed, ignore") } log.Info(). Str("packageName", app.PackageName). @@ -484,10 +485,13 @@ func (dExt *DriverExt) assertActivity(packageName, activityType string) error { } // assert failed - log.Error().Interface("app", app.AppBaseInfo).Msg("app activity not match") - return errors.Wrap(code.MobileUIActivityNotMatchError, - fmt.Sprintf("foreground activity %s, expect %s %s", - app.Activity, activityType, expectActivity)) + log.Error(). + Interface("app", app.AppBaseInfo). + Str("expectActivityType", activityType). + Str("expectActivity", expectActivity). + Msg("assert activity failed") + + return errors.Wrap(code.MobileUIActivityNotMatchError, "assert activity failed") } // TODO: add more popup texts