fix(sandbox): name a failed Function's error from its headline, not an inspected property
Merged
WA
16d ago+212+212+012345678901234567890123456789-4-4-0123456789
Summary
- A failed sandboxed Function (E2B / Daytona, JavaScript and Python) named its error from the last trimmed
identifier: valueline of stderr. Node prints an error's own properties indented beneath it, so the error took the name of a property: afetchthat lost its socket surfaced asbytesRead: 0(a reset assyscall: 'read'), anENOENTas itspath, a custom error as one of its fields, a missing module ascode: 'ERR_MODULE_NOT_FOUND'. - Match only top-level error headlines: unindented, with a space after the colon (so source-location headers like
node:internal/x:12/file:///x.mjs:3don't match), plus Node'sName [CODE]: messageand bracketed[Name: message] {forms. The traceback itself is unchanged and still returned in full.
Type of Change
- Bug fix
Testing
- Ran 33 real failure shapes through
node22 andpython3(socket closed / reset / refused fetches, custom errors with properties, ENOENT, coded Node errors, AggregateError, cause chains, thrown strings/objects, syntax errors, Python tracebacks incl. chained, custom-module and SyntaxError) and compared old vs new parser: 13 now name the real error, 20 unchanged (every Python case), none worse - New
code-failure.test.tsbuilt from real stderr fixtures; 5 of its cases fail on the previous parser (incl. thebytesRead: 0fetch case), Python cases pass on both - biome on changed files
Checklist
- Code follows project style guidelines
- Self-reviewed my changes
- Tests added/updated and passing (new tests pass the
test-auditauthoring gate) - No new warnings introduced
- I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)