From cca7da9da2d9727c40804dfd10b16815275c7468 Mon Sep 17 00:00:00 2001 From: Matt Aitken Date: Tue, 4 Jul 2023 16:15:47 +0100 Subject: [PATCH] Better docs for io.try --- .changeset/beige-maps-hug.md | 5 +++++ packages/trigger-sdk/src/io.ts | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .changeset/beige-maps-hug.md diff --git a/.changeset/beige-maps-hug.md b/.changeset/beige-maps-hug.md new file mode 100644 index 000000000..46b127eae --- /dev/null +++ b/.changeset/beige-maps-hug.md @@ -0,0 +1,5 @@ +--- +"@trigger.dev/sdk": patch +--- + +Better docs for io.try diff --git a/packages/trigger-sdk/src/io.ts b/packages/trigger-sdk/src/io.ts index 7fe62f5f8..2f91cfc8b 100644 --- a/packages/trigger-sdk/src/io.ts +++ b/packages/trigger-sdk/src/io.ts @@ -619,8 +619,8 @@ export class IO { /** `io.try()` allows you to run Tasks and catch any errors that are thrown, it's similar to a normal `try/catch` block but works with [io.runTask()](/sdk/io/runtask). * A regular `try/catch` block on its own won't work as expected with Tasks. Internally `runTask()` throws some special errors to control flow execution. This is necessary to deal with resumability, serverless timeouts, and retrying Tasks. - * @param tryCallback The callback that will be called when the Task is run. The callback receives the Task and the IO as parameters. - * @param catchCallback The callback that will be called when the Task fails. The callback receives the error + * @param tryCallback The code you wish to run + * @param catchCallback Thhis will be called if the Task fails. The callback receives the error * @returns A Promise that resolves with the returned value or the error */ async try(