From f4b60f4d86814b18afeebdeb6173dbd09fe1e460 Mon Sep 17 00:00:00 2001 From: "lilong.129" Date: Fri, 20 Jun 2025 19:36:01 +0800 Subject: [PATCH] fix: update error handling in runStepMobileUI to store error messages as strings --- internal/version/VERSION | 2 +- step.go | 2 +- step_ui.go | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/version/VERSION b/internal/version/VERSION index 2ad58c7b..6a80a320 100644 --- a/internal/version/VERSION +++ b/internal/version/VERSION @@ -1 +1 @@ -v5.0.0-beta-2506201912 +v5.0.0-beta-2506201936 diff --git a/step.go b/step.go index 7f66708c..3b2c866f 100644 --- a/step.go +++ b/step.go @@ -60,7 +60,7 @@ type ActionResult struct { option.MobileAction `json:",inline"` StartTime int64 `json:"start_time"` // action start time in millisecond(ms) Elapsed int64 `json:"elapsed_ms"` // action elapsed time(ms) - Error error `json:"error,omitempty"` // action execution result + Error string `json:"error,omitempty"` // action execution result Plannings []*uixt.PlanningExecutionResult `json:"plannings,omitempty"` // store planning results for start_to_goal actions, which contains multiple sub-actions uixt.SessionData // store session data for other actions besides start_to_goal } diff --git a/step_ui.go b/step_ui.go index a1596eed..426621cb 100644 --- a/step_ui.go +++ b/step_ui.go @@ -786,7 +786,7 @@ func runStepMobileUI(s *SessionRunner, step IStep) (stepResult *StepResult, err sessionData, err1 := uiDriver.ExecuteAction( context.Background(), actionResult.MobileAction) if err1 != nil { - actionResult.Error = err1 + actionResult.Error = err1.Error() log.Warn().Err(err1).Msg("get foreground app failed, ignore") } actionResult.Elapsed = time.Since(startTime).Milliseconds() @@ -831,7 +831,7 @@ func runStepMobileUI(s *SessionRunner, step IStep) (stepResult *StepResult, err sessionData, err2 := uiDriver.ExecuteAction( context.Background(), actionResult.MobileAction) if err2 != nil { - actionResult.Error = err2 + actionResult.Error = err2.Error() log.Warn().Err(err2).Str("step", step.Name()).Msg("auto handle popup failed") } actionResult.Elapsed = time.Since(startTime).Milliseconds() @@ -953,11 +953,11 @@ func runStepMobileUI(s *SessionRunner, step IStep) (stepResult *StepResult, err // handle other actions sessionData, err := uiDriver.ExecuteAction(ctx, action) - actionResult.Error = err actionResult.Elapsed = time.Since(actionStartTime).Milliseconds() actionResult.SessionData = sessionData stepResult.Actions = append(stepResult.Actions, actionResult) if err != nil { + actionResult.Error = err.Error() if !code.IsErrorPredefined(err) { err = errors.Wrap(code.MobileUIDriverError, err.Error()) }