Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fix-command-handle-sandbox-exception.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"e2b": patch
---

Raise `SandboxException` instead of bare `Exception` in `CommandHandle.wait()` when the command stream ends without an exit event, giving a clearer error message when the sandbox was killed, paused, or timed out mid-stream.
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,9 @@ async def wait(self) -> CommandResult:
raise self._iteration_exception

if self._result is None:
raise Exception("Command ended without an end event")
raise SandboxException(
"Command stream ended without an exit event. The sandbox may have been killed, paused, or timed out."
)
Comment thread
AdaAibaby marked this conversation as resolved.
Comment thread
AdaAibaby marked this conversation as resolved.

if self._result.exit_code != 0:
raise CommandExitException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,9 @@ def wait(
raise self._iteration_exception

if self._result is None:
raise Exception("Command ended without an end event")
raise SandboxException(
"Command stream ended without an exit event. The sandbox may have been killed, paused, or timed out."
)
Comment thread
AdaAibaby marked this conversation as resolved.

if self._result.exit_code != 0:
raise CommandExitException(
Expand Down