You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by ab...@apache.org on 2023/04/24 13:07:40 UTC
[incubator-devlake] branch main updated: fix: log the panic errors (#5023)
This is an automated email from the ASF dual-hosted git repository.
abeizn pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/main by this push:
new 5d81ae6dc fix: log the panic errors (#5023)
5d81ae6dc is described below
commit 5d81ae6dc3e4f127286a94753b63feab633c0c48
Author: Liang Zhang <li...@merico.dev>
AuthorDate: Mon Apr 24 21:07:35 2023 +0800
fix: log the panic errors (#5023)
* fix: log the panic errors
* fix: linter complain
---
backend/core/runner/run_task.go | 9 ++++++---
backend/helpers/pluginhelper/api/worker_scheduler.go | 8 +++++++-
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/backend/core/runner/run_task.go b/backend/core/runner/run_task.go
index 0e4d4678d..75bb910f1 100644
--- a/backend/core/runner/run_task.go
+++ b/backend/core/runner/run_task.go
@@ -67,9 +67,8 @@ func RunTask(
default:
e = fmt.Errorf("%v", et)
}
- if !dbPipeline.SkipOnFail {
- err = errors.Default.Wrap(e, fmt.Sprintf("run task failed with panic (%s)", utils.GatherCallFrames(0)))
- }
+ err = errors.Default.Wrap(e, fmt.Sprintf("run task failed with panic (%s)", utils.GatherCallFrames(0)))
+ logger.Error(err, "run task failed with panic")
}
finishedAt := time.Now()
spentSeconds := finishedAt.Unix() - beganAt.Unix()
@@ -114,6 +113,10 @@ func RunTask(
if dbe != nil {
logger.Error(dbe, "update pipeline state failed")
}
+ // not return err if the `SkipOnFail` is true
+ if dbPipeline.SkipOnFail {
+ err = nil
+ }
}()
// start execution
diff --git a/backend/helpers/pluginhelper/api/worker_scheduler.go b/backend/helpers/pluginhelper/api/worker_scheduler.go
index c9ee31e85..d7cfc5096 100644
--- a/backend/helpers/pluginhelper/api/worker_scheduler.go
+++ b/backend/helpers/pluginhelper/api/worker_scheduler.go
@@ -19,6 +19,7 @@ package api
import (
"context"
+ "fmt"
"sync"
"sync/atomic"
"time"
@@ -135,7 +136,12 @@ func (s *WorkerScheduler) checkError(err interface{}) {
if err == nil {
return
}
- s.appendError(err.(error))
+ switch e := err.(type) {
+ case error:
+ s.appendError(e)
+ default:
+ s.appendError(fmt.Errorf("%v", e))
+ }
}
// HasError return if any error occurred