Commit 3c5d273
committed
fix: guard error handler against non-object thrown values
The `in` operator throws a TypeError when its right-hand operand is not
an object. In the tool execution error handler, both `'message' in err`
and `'cause' in err` will crash if the caught value is a primitive
(null, string, number, undefined).
Add `typeof err === 'object'` checks before using the `in` operator to
ensure primitive thrown values are safely converted to strings.1 parent 8d765c0 commit 3c5d273
1 file changed
Lines changed: 5 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
225 | 225 | | |
226 | 226 | | |
227 | 227 | | |
228 | | - | |
229 | | - | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
230 | 233 | | |
231 | 234 | | |
232 | 235 | | |
| |||
0 commit comments