Skip to content

Commit 7308b53

Browse files
committed
fix(executor): restore logging for invalid JSON in parseRoutes
parseJSON(input, []) returns [] on parse failure, making the subsequent !Array.isArray check unreachable for the invalid-JSON case. Use null as the fallback to distinguish parse failure from valid-but- not-array, and log both cases separately.
1 parent 3db1617 commit 7308b53

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

apps/sim/executor/handlers/router/router-handler.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,11 +375,15 @@ export class RouterBlockHandler implements BlockHandler {
375375
if (Array.isArray(input)) {
376376
return input
377377
}
378-
const parsed = parseJSON(input, [])
379-
if (!Array.isArray(parsed)) {
378+
const parsed = parseJSON(input, null)
379+
if (parsed === null) {
380380
logger.error('Failed to parse routes:', { input })
381381
return []
382382
}
383+
if (!Array.isArray(parsed)) {
384+
logger.error('Routes parsed but is not an array:', { input, parsed })
385+
return []
386+
}
383387
return parsed
384388
}
385389

0 commit comments

Comments
 (0)