This is an automated email from the ASF dual-hosted git repository.

zhangliang2022 pushed a commit to branch release-v0.14
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


The following commit(s) were added to refs/heads/release-v0.14 by this push:
     new 993487e2a refactor: improve the error message for pipeline and task 
(#3985) (#3989)
993487e2a is described below

commit 993487e2ab2ee588a1460dc732efefd95a80ecff
Author: mindlesscloud <[email protected]>
AuthorDate: Tue Dec 20 20:51:13 2022 +0800

    refactor: improve the error message for pipeline and task (#3985) (#3989)
---
 runner/run_task.go          | 2 +-
 services/pipeline_runner.go | 6 +-----
 services/task.go            | 8 +++++++-
 3 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/runner/run_task.go b/runner/run_task.go
index d003187d0..333909831 100644
--- a/runner/run_task.go
+++ b/runner/run_task.go
@@ -82,7 +82,7 @@ func RunTask(
                        }
                        dbe := db.Model(task).Updates(map[string]interface{}{
                                "status":          models.TASK_FAILED,
-                               "message":         lakeErr.Messages().Format(),
+                               "message":         lakeErr.Error(),
                                "finished_at":     finishedAt,
                                "spent_seconds":   spentSeconds,
                                "failed_sub_task": subTaskName,
diff --git a/services/pipeline_runner.go b/services/pipeline_runner.go
index 5ab5c4c68..b7a938fc5 100644
--- a/services/pipeline_runner.go
+++ b/services/pipeline_runner.go
@@ -125,11 +125,7 @@ func runPipeline(pipelineId uint64) errors.Error {
        pipeline.SpentSeconds = int(finishedAt.Unix() - pipeline.BeganAt.Unix())
        if err != nil {
                pipeline.Status = models.TASK_FAILED
-               if lakeErr := errors.AsLakeErrorType(err); lakeErr != nil {
-                       pipeline.Message = lakeErr.Messages().Format()
-               } else {
-                       pipeline.Message = err.Error()
-               }
+               pipeline.Message = err.Error()
        } else {
                pipeline.Status = models.TASK_COMPLETED
                pipeline.Message = ""
diff --git a/services/task.go b/services/task.go
index 21d2d8c07..afe137f85 100644
--- a/services/task.go
+++ b/services/task.go
@@ -24,6 +24,7 @@ import (
        "fmt"
        "regexp"
        "strconv"
+       "strings"
        "sync"
 
        "github.com/apache/incubator-devlake/errors"
@@ -245,7 +246,12 @@ func runTasksStandalone(parentLogger core.Logger, taskIds 
[]uint64) errors.Error
                }
        }
        if len(errs) > 0 {
-               err = errors.Default.Combine(errs)
+               var sb strings.Builder
+               for _, e := range errs {
+                       _, _ = sb.WriteString(e.Error())
+                       _, _ = sb.WriteString("\n")
+               }
+               err = errors.Default.New(sb.String())
        }
        return errors.Convert(err)
 }

Reply via email to