RunExecutorOnce wraps a TaskExecutor.RunOnce call with panic recovery.
(ctx context.Context, driverCtx context.Context, exec Executor, task *store.TaskMessage, taskRunUID int64)
| 22 | |
| 23 | // RunExecutorOnce wraps a TaskExecutor.RunOnce call with panic recovery. |
| 24 | func RunExecutorOnce(ctx context.Context, driverCtx context.Context, exec Executor, task *store.TaskMessage, taskRunUID int64) (result *storepb.TaskRunResult, err error) { |
| 25 | defer func() { |
| 26 | if r := recover(); r != nil { |
| 27 | panicErr, ok := r.(error) |
| 28 | if !ok { |
| 29 | panicErr = errors.Errorf("%v", r) |
| 30 | } |
| 31 | slog.ErrorContext(ctx, "TaskExecutor PANIC RECOVER", log.BBError(panicErr), log.BBStack("panic-stack")) |
| 32 | result = nil |
| 33 | err = errors.Errorf("TaskExecutor PANIC RECOVER, err: %v", panicErr) |
| 34 | } |
| 35 | }() |
| 36 | |
| 37 | return exec.RunOnce(ctx, driverCtx, task, taskRunUID) |
| 38 | } |
no test coverage detected