Skip to content

Commit 695ca94

Browse files
authored
improvement(workflows): a clean errorMessage on Function errors and table writes report ignored columns (#10328)
Function blocks that fail now also output errorMessage, the thrown message without the line/code prefix, alongside the unchanged .error; it is declared as a typed error-only output that compile, lint, codegen and the executor read wherever .error is. Table writes return ignoredColumns, the keys they dropped because no column matched, with runtime write behaviour unchanged.
1 parent 3da138d commit 695ca94

58 files changed

Lines changed: 1529 additions & 518 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎apps/docs/content/docs/cli/blocks.mdx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ Reading it for `sim workflows operations apply`:
6161
inputDefinitions the block's inputs by name; one a pair of fields shares (tableId for
6262
tableSelector and manualTableId) is accepted in place of the pair
6363
outputs what it outputs on success; a failed block outputs {"error":"…"}
64-
instead, read on its error path as <name.error>
64+
instead, read on its error path as <name.error> (a Function also
65+
outputs <name.errorMessage>, the thrown message without line or code)
6566
Block settings such as retry are not fields: `sim workflows operations apply --help`.
6667
```
6768

‎apps/docs/content/docs/cli/reference.mdx‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,8 @@ Reading it for `sim workflows operations apply`:
434434
inputDefinitions the block's inputs by name; one a pair of fields shares (tableId for
435435
tableSelector and manualTableId) is accepted in place of the pair
436436
outputs what it outputs on success; a failed block outputs {"error":"…"}
437-
instead, read on its error path as <name.error>
437+
instead, read on its error path as <name.error> (a Function also
438+
outputs <name.errorMessage>, the thrown message without line or code)
438439
Block settings such as retry are not fields: `sim workflows operations apply --help`.
439440
```
440441

@@ -7802,7 +7803,9 @@ Block settings, beside inputs in an add's or edit's params:
78027803
5xx, not when the host does not resolve or refuses the connection; "retry" covers that.
78037804
Outputs:
78047805
A block that fails outputs {"error":"<message>"}: connect its error handle and read
7805-
<name.error> there (without one, the run fails). A Workflow block's result is the child's
7806+
<name.error> there (without one, the run fails). A Function's error leads with the line and
7807+
code that threw; its <name.errorMessage> is the thrown message alone, the one to reply with.
7808+
A Workflow block's result is the child's
78067809
output; a child ending in a Response block gives {data, status, headers}, so read
78077810
<call.result.data.x>.
78087811
```

‎apps/docs/content/docs/cli/workflows.mdx‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,9 @@ Block settings, beside inputs in an add's or edit's params:
372372
5xx, not when the host does not resolve or refuses the connection; "retry" covers that.
373373
Outputs:
374374
A block that fails outputs {"error":"<message>"}: connect its error handle and read
375-
<name.error> there (without one, the run fails). A Workflow block's result is the child's
375+
<name.error> there (without one, the run fails). A Function's error leads with the line and
376+
code that threw; its <name.errorMessage> is the thrown message alone, the one to reply with.
377+
A Workflow block's result is the child's
376378
output; a child ending in a Response block gives {data, status, headers}, so read
377379
<call.result.data.x>.
378380
```

‎apps/docs/content/docs/integrations/table.mdx‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ Insert a new row into a table. IMPORTANT: You must use the "data" parameter (not
5252

5353
| Parameter | Type | Description |
5454
| --------- | ---- | ----------- |
55+
| `ignoredColumns` | array | Keys of the written data that name no column of the table, which the write dropped. Empty when every key matched a column. |
5556
| `success` | boolean | Whether row was inserted |
5657
| `row` | json | Inserted row data |
5758
| `message` | string | Status message |
@@ -75,6 +76,7 @@ Insert multiple rows into a table at once (up to 1000 rows)
7576

7677
| Parameter | Type | Description |
7778
| --------- | ---- | ----------- |
79+
| `ignoredColumns` | array | Keys of the written data that name no column of the table, which the write dropped. Empty when every key matched a column. |
7880
| `success` | boolean | Whether rows were inserted |
7981
| `rows` | array | Inserted rows data |
8082
| `insertedCount` | number | Number of rows inserted |
@@ -100,6 +102,7 @@ Insert or update a row based on unique column constraints. If a row with matchin
100102

101103
| Parameter | Type | Description |
102104
| --------- | ---- | ----------- |
105+
| `ignoredColumns` | array | Keys of the written data that name no column of the table, which the write dropped. Empty when every key matched a column. |
103106
| `success` | boolean | Whether row was upserted |
104107
| `row` | json | Upserted row data |
105108
| `operation` | string | Operation performed: insert or update |
@@ -125,6 +128,7 @@ Update an existing row in a table. Supports partial updates - only include the f
125128

126129
| Parameter | Type | Description |
127130
| --------- | ---- | ----------- |
131+
| `ignoredColumns` | array | Keys of the written data that name no column of the table, which the write dropped. Empty when every key matched a column. |
128132
| `success` | boolean | Whether row was updated |
129133
| `row` | json | Updated row data |
130134
| `message` | string | Status message |
@@ -150,6 +154,7 @@ Update multiple rows that match filter criteria. Data is merged with existing ro
150154

151155
| Parameter | Type | Description |
152156
| --------- | ---- | ----------- |
157+
| `ignoredColumns` | array | Keys of the written data that name no column of the table, which the write dropped. Empty when every key matched a column. |
153158
| `success` | boolean | Whether rows were updated |
154159
| `updatedCount` | number | Number of rows updated |
155160
| `updatedRowIds` | array | IDs of updated rows |

‎apps/docs/content/docs/tables/using-in-workflows.mdx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ Use **Get Row by ID** for a point lookup and **Get Schema** for column definitio
126126
}
127127
```
128128

129+
A key that names no column is dropped, and the write still succeeds. Every insert, upsert, and update reports the dropped keys in `<table.ignoredColumns>`, an empty list when every key matched, so a downstream condition can catch a misspelled column. Public v2 API writes reject an unknown column instead.
130+
129131
Upsert requires a unique column. If the table has several, select **Conflict Column** to choose the match target. Unlisted fields remain unchanged in a partial update.
130132

131133
For different results per row, use a sequential Loop and **Update Row by ID**. A filter update applies the same values to every match; with no **Limit**, it walks all matches in batches. The 1,000 maximum applies to an explicitly supplied update limit, not the total for an unlimited filtered update.

‎apps/docs/content/docs/workflows/blocks/function.mdx‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,15 @@ The lazy `sim.files` and `sim.values` helpers are available only in JavaScript f
435435

436436
An uncaught error follows the connected error port or fails the run. Catch an error only when your code can return a meaningful recovery result. `console.log()`, `print()`, and ordinary Shell output appear in `stdout` and the run logs.
437437

438+
On the error path, the failed block has two outputs:
439+
440+
| Output | What it is |
441+
| --- | --- |
442+
| `<function.error>` | The message with the line and code that threw: ``Line 4: `throw new Error('invalid phone')` - invalid phone`` |
443+
| `<function.errorMessage>` | The thrown message alone: `invalid phone` |
444+
445+
Use `<function.errorMessage>` in a reply to a caller, such as a Response block's body, so the caller never sees your code. Use `<function.error>` when you need the line to debug. A failure your code did not throw, such as a timeout, has no line, so both hold the same message.
446+
438447
Function uses the workflow's remaining execution time when a deadline exists. Without a workflow deadline, it still has a fallback timeout of 300,000 ms (5 minutes) by default, configurable through `EXECUTION_TIMEOUT_FREE`. An explicit internal timeout can replace that fallback or shorten the workflow budget; it cannot extend the workflow deadline. There is no separate timeout field in the current block editor. Exceeding the budget terminates execution and reports a block error.
439448

440449
## Related docs

‎apps/docs/openapi-v2-resources.json‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32872,6 +32872,13 @@
3287232872
"required": ["source", "param"],
3287332873
"additionalProperties": false
3287432874
},
32875+
"errorOutputs": {
32876+
"description": "Text outputs the block writes only when it fails into an error edge, beside `error`.",
32877+
"type": "array",
32878+
"items": {
32879+
"type": "string"
32880+
}
32881+
},
3287532882
"graph": {
3287632883
"type": "object",
3287732884
"properties": {

0 commit comments

Comments
 (0)