File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed
packages/payload/src/queues/operations/runJobs/runJob Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -79,9 +79,17 @@ export async function handleTaskFailed({
79
79
if ( ! job . log ) {
80
80
job . log = [ ]
81
81
}
82
+ const errorJSON = error
83
+ ? {
84
+ name : error . name ,
85
+ message : error . message ,
86
+ stack : error . stack ,
87
+ }
88
+ : runnerOutput . state
89
+
82
90
job . log . push ( {
83
91
completedAt : new Date ( ) . toISOString ( ) ,
84
- error : error ?? runnerOutput . state ,
92
+ error : errorJSON ,
85
93
executedAt : executedAt . toISOString ( ) ,
86
94
input,
87
95
output,
Original file line number Diff line number Diff line change @@ -56,10 +56,17 @@ export const runJob = async ({
56
56
workflowConfig,
57
57
} )
58
58
59
+ const errorJSON = hasFinalError
60
+ ? {
61
+ name : err . name ,
62
+ message : err . message ,
63
+ stack : err . stack ,
64
+ }
65
+ : undefined
59
66
// Tasks update the job if they error - but in case there is an unhandled error (e.g. in the workflow itself, not in a task)
60
67
// we need to ensure the job is updated to reflect the error
61
68
await updateJob ( {
62
- error : hasFinalError ? err : undefined ,
69
+ error : errorJSON ,
63
70
hasError : hasFinalError , // If reached max retries => final error. If hasError is true this job will not be retried
64
71
processing : false ,
65
72
totalTried : ( job . totalTried ?? 0 ) + 1 ,
You can’t perform that action at this time.
0 commit comments