Skip to content

Commit 0b39a4c

Browse files
committed
new import payload error code
1 parent f710326 commit 0b39a4c

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

packages/core/src/v3/schemas/common.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ export const TaskRunErrorCodes = {
9898
DISK_SPACE_EXCEEDED: "DISK_SPACE_EXCEEDED",
9999
POD_EVICTED: "POD_EVICTED",
100100
POD_UNKNOWN_ERROR: "POD_UNKNOWN_ERROR",
101+
IMPORT_PAYLOAD_ERROR: "IMPORT_PAYLOAD_ERROR",
101102
} as const;
102103

103104
export const TaskRunInternalError = z.object({
@@ -124,6 +125,7 @@ export const TaskRunInternalError = z.object({
124125
"DISK_SPACE_EXCEEDED",
125126
"POD_EVICTED",
126127
"POD_UNKNOWN_ERROR",
128+
"IMPORT_PAYLOAD_ERROR",
127129
]),
128130
message: z.string().optional(),
129131
stackTrace: z.string().optional(),

packages/core/src/v3/workers/taskExecutor.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,28 @@ export class TaskExecutor {
9292

9393
try {
9494
const payloadPacket = await conditionallyImportPacket(originalPacket, this._tracer);
95-
9695
parsedPayload = await parsePacket(payloadPacket);
96+
} catch (packetError) {
97+
recordSpanException(span, packetError);
98+
99+
return {
100+
ok: false,
101+
id: execution.run.id,
102+
error: {
103+
type: "INTERNAL_ERROR",
104+
code: TaskRunErrorCodes.IMPORT_PAYLOAD_ERROR,
105+
message:
106+
packetError instanceof Error
107+
? `${packetError.name}: ${packetError.message}`
108+
: typeof packetError === "string"
109+
? packetError
110+
: undefined,
111+
stackTrace: packetError instanceof Error ? packetError.stack : undefined,
112+
},
113+
} satisfies TaskRunExecutionResult;
114+
}
97115

116+
try {
98117
if (execution.attempt.number === 1) {
99118
await this.#callOnStartFunctions(parsedPayload, ctx, signal);
100119
}

0 commit comments

Comments
 (0)