Skip to content

Commit 9810645

Browse files
feat : Errors thrown in onStart should fail the run with that error
1 parent 75753ec commit 9810645

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

references/bun-catalog/trigger.config.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { defineConfig } from "@trigger.dev/sdk/v3";
2+
import { logger } from "../../packages/core/dist/commonjs/v3/logger-api.js";
23

34
export default defineConfig({
45
runtime: "bun",
@@ -18,7 +19,11 @@ export default defineConfig({
1819
enableConsoleLogging: false,
1920
logLevel: "info",
2021
onStart: async (payload, { ctx }) => {
21-
console.log(`Task ${ctx.task.id} started ${ctx.run.id}`);
22+
try {
23+
console.log(`Task ${ctx.task.id} started ${ctx.run.id}`);
24+
} catch (error) {
25+
console.log(error)
26+
}
2227
},
2328
onFailure: async (payload, error, { ctx }) => {
2429
console.log(`Task ${ctx.task.id} failed ${ctx.run.id}`);

references/v3-catalog/trigger.config.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ export default defineConfig({
3131
enableConsoleLogging: false,
3232
logLevel: "info",
3333
onStart: async (payload, { ctx }) => {
34-
console.log(`Task ${ctx.task.id} started ${ctx.run.id}`);
34+
try {
35+
console.log(`Task ${ctx.task.id} started ${ctx.run.id}`);
36+
} catch (error) {
37+
console.log(error)
38+
}
3539
},
3640
onFailure: async (payload, error, { ctx }) => {
3741
console.log(

0 commit comments

Comments
 (0)