Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion src/content/docs/workflows/build/workers-api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,24 @@ Get a specific Workflow instance by ID.

* `id` - the ID of the Workflow instance.

Returns a `WorkflowInstance`.
Returns a `WorkflowInstance`. Throws an exception if the instance ID does not exist.

```ts
// Fetch an existing Workflow instance by ID:
try {
let instance = await env.MY_WORKFLOW.get(id)
return Response.json({
id: instance.id,
details: await instance.status(),
});
} catch (e: any) {
// Handle errors
// .get will throw an exception if the ID doesn't exist or is invalid.
const msg = `failed to get instance ${id}: ${e.message}`
console.error(msg)
return Response.json({error: msg}, { status: 400 })
}
```

## WorkflowInstanceCreateOptions

Expand Down
Loading