Skip to content

Commit d3719b1

Browse files
committed
pretty segfault errors
1 parent c5813c4 commit d3719b1

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

packages/core/src/v3/errors.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ export function shouldRetryError(error: TaskRunError): boolean {
149149
case "TASK_ALREADY_RUNNING":
150150
case "TASK_PROCESS_EXITED_WITH_NON_ZERO_CODE":
151151
case "TASK_PROCESS_SIGKILL_TIMEOUT":
152+
case "TASK_PROCESS_SIGSEGV":
152153
case "TASK_PROCESS_SIGTERM":
153154
case "TASK_PROCESS_OOM_KILLED":
154155
case "TASK_PROCESS_MAYBE_OOM_KILLED":
@@ -397,6 +398,15 @@ const prettyInternalErrors: Partial<
397398
href: links.docs.machines.home,
398399
},
399400
},
401+
TASK_PROCESS_SIGSEGV: {
402+
message:
403+
"Your task crashed with a segmentation fault (SIGSEGV). Most likely there's a bug in a package or binary you're using. If this keeps happening and you're unsure why, please get in touch.",
404+
link: {
405+
name: "Contact us",
406+
href: links.site.contact,
407+
magic: "CONTACT_FORM",
408+
},
409+
},
400410
TASK_PROCESS_SIGTERM: {
401411
message:
402412
"Your task exited after receiving SIGTERM but we don't know why. If this keeps happening, please get in touch so we can investigate.",
@@ -419,6 +429,12 @@ export function taskRunErrorEnhancer(error: TaskRunError): EnhanceError<TaskRunE
419429
code: TaskRunErrorCodes.TASK_PROCESS_SIGTERM,
420430
...prettyInternalErrors.TASK_PROCESS_SIGTERM,
421431
};
432+
} else if (error.message.includes("SIGSEGV")) {
433+
return {
434+
type: "INTERNAL_ERROR",
435+
code: TaskRunErrorCodes.TASK_PROCESS_SIGSEGV,
436+
...prettyInternalErrors.TASK_PROCESS_SIGSEGV,
437+
};
422438
}
423439

424440
return {
@@ -454,6 +470,12 @@ export function taskRunErrorEnhancer(error: TaskRunError): EnhanceError<TaskRunE
454470
code: TaskRunErrorCodes.TASK_PROCESS_SIGTERM,
455471
...prettyInternalErrors.TASK_PROCESS_SIGTERM,
456472
};
473+
} else if (error.message?.includes("SIGSEGV")) {
474+
return {
475+
type: "INTERNAL_ERROR",
476+
code: TaskRunErrorCodes.TASK_PROCESS_SIGSEGV,
477+
...prettyInternalErrors.TASK_PROCESS_SIGSEGV,
478+
};
457479
}
458480

459481
return {

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ export const TaskRunInternalError = z.object({
8989
"TASK_EXECUTION_ABORTED",
9090
"TASK_PROCESS_EXITED_WITH_NON_ZERO_CODE",
9191
"TASK_PROCESS_SIGKILL_TIMEOUT",
92+
"TASK_PROCESS_SIGSEGV",
9293
"TASK_PROCESS_SIGTERM",
9394
"TASK_PROCESS_OOM_KILLED",
9495
"TASK_PROCESS_MAYBE_OOM_KILLED",

0 commit comments

Comments
 (0)