Skip to content

Commit 4f85119

Browse files
authored
Misc fixes related to error display (#1397)
* Fix execute error handling * replace internal errors on attempts * correctly display env var errors while indexing * display correct errors on crashed attempts * add changeset
1 parent 94170de commit 4f85119

File tree

5 files changed

+16
-8
lines changed

5 files changed

+16
-8
lines changed

.changeset/sweet-spies-play.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"trigger.dev": patch
3+
"@trigger.dev/core": patch
4+
---
5+
6+
Correctly display errors on attempts and during indexing

apps/webapp/app/v3/services/crashTaskRun.server.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export class CrashTaskRunService extends BaseService {
9797
event: event,
9898
crashedAt: opts.crashedAt,
9999
exception: {
100-
type: "Worker crashed",
100+
type: opts.errorCode ?? "TASK_RUN_CRASHED",
101101
message: opts.reason,
102102
stacktrace: opts.logs,
103103
},
@@ -119,6 +119,7 @@ export class CrashTaskRunService extends BaseService {
119119
{
120120
reason: opts.reason,
121121
logs: opts.logs,
122+
code: opts.errorCode,
122123
}
123124
);
124125
}

packages/cli-v3/src/entryPoints/deploy-index-controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ async function indexDeployment({
6161
const $env = await cliApiClient.getEnvironmentVariables(projectRef);
6262

6363
if (!$env.success) {
64-
throw new Error(`Failed to fetch environment variables: ${env.error}`);
64+
throw new Error(`Failed to fetch environment variables: ${$env.error}`);
6565
}
6666

6767
const workerManifest = await indexWorkerManifest({

packages/cli-v3/src/entryPoints/deploy-run-controller.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -784,12 +784,6 @@ class ProdWorker {
784784
error,
785785
});
786786

787-
try {
788-
await this._taskRunProcess.cancel();
789-
} catch (error) {
790-
logger.error("Failed to cancel task run process", { error });
791-
}
792-
793787
try {
794788
await this.#submitAttemptCompletion(execution, {
795789
id: execution.run.id,

packages/core/src/v3/errors.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,13 @@ export function exceptionEventEnhancer(
395395
}
396396
break;
397397
}
398+
case TaskRunErrorCodes.TASK_PROCESS_MAYBE_OOM_KILLED:
399+
case TaskRunErrorCodes.TASK_PROCESS_OOM_KILLED: {
400+
return {
401+
...exception,
402+
...prettyInternalErrors[exception.type],
403+
};
404+
}
398405
}
399406

400407
return exception;

0 commit comments

Comments
 (0)