Skip to content

Map Python ProtocolError responses to BridgeProtocolError #94

@bbopen

Description

@bbopen

Summary

When the Python bridge returns an error payload with type: "ProtocolError", NodeBridge/OptimizedNodeBridge wraps it as BridgeExecutionError. This misclassifies protocol violations as execution errors and makes it harder to differentiate user-code failures from protocol issues.

Failure mode

  • Python bridge returns { error: { type: "ProtocolError", message: "..." } }.
  • JS side throws BridgeExecutionError instead of BridgeProtocolError.

Evidence

  • src/runtime/node.ts errorFrom always returns BridgeExecutionError.
  • src/runtime/optimized-node.ts errorFrom same pattern.

Proposed fix

  • If err.type === 'ProtocolError', return BridgeProtocolError (and include message/traceback).
  • Otherwise keep BridgeExecutionError.

Acceptance criteria

  • ProtocolError from Python surfaces as BridgeProtocolError on the JS side.
  • Tests cover a custom bridge returning ProtocolError.

Metadata

Metadata

Assignees

Labels

area:runtime-nodeArea: Node runtime bridgebugSomething isn't workingpriority:p3Priority P3 (low)

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions