Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

Report invalid event type

Tomas Valenta50fbb9c67460
diff --git a/packages/js-sdk/src/sandbox/filesystem/index.ts b/packages/js-sdk/src/sandbox/filesystem/index.ts
index 756db8f58..465cb8c30 100644
--- a/packages/js-sdk/src/sandbox/filesystem/index.ts
+++ b/packages/js-sdk/src/sandbox/filesystem/index.ts
@@ -276,7 +276,7 @@ export class Filesystem {
const startEvent: WatchDirResponse = (await events[Symbol.asyncIterator]().next()).value
if (startEvent.event.case !== 'start') {
- throw new SandboxError('Expected start event')
+ throw new SandboxError(`Expected start event, got ${startEvent.event}`)
}
clearTimeout(reqTimeout)
diff --git a/packages/js-sdk/src/sandbox/process/index.ts b/packages/js-sdk/src/sandbox/process/index.ts
index 15539f7fa..dffe4beb3 100644
--- a/packages/js-sdk/src/sandbox/process/index.ts
+++ b/packages/js-sdk/src/sandbox/process/index.ts
@@ -134,7 +134,7 @@ export class Process {
const startEvent: StartResponse = (await events[Symbol.asyncIterator]().next()).value
if (startEvent.event?.event.case !== 'start') {
- throw new SandboxError('Expected start event')
+ throw new SandboxError(`Expected start event, got ${startEvent.event?.event}`)
}
clearTimeout(reqTimeout)
@@ -196,7 +196,7 @@ export class Process {
const startEvent: StartResponse = (await events[Symbol.asyncIterator]().next()).value
if (startEvent.event?.event.case !== 'start') {
- throw new SandboxError('Expected start event')
+ throw new SandboxError(`Expected start event, got ${startEvent.event?.event}`)
}
clearTimeout(reqTimeout)
diff --git a/packages/python-sdk/e2b/sandbox/filesystem/filesystem.py b/packages/python-sdk/e2b/sandbox/filesystem/filesystem.py
index 1f8219a04..4f50a8b32 100644
--- a/packages/python-sdk/e2b/sandbox/filesystem/filesystem.py
+++ b/packages/python-sdk/e2b/sandbox/filesystem/filesystem.py
@@ -73,8 +73,7 @@ class Filesystem:
format: Literal["text"] = "text",
user: Username = "user",
request_timeout: Optional[float] = None,
- ) -> str:
- ...
+ ) -> str: ...
@overload
def read(
@@ -83,8 +82,7 @@ class Filesystem:
format: Literal["bytes"],
user: Username = "user",
request_timeout: Optional[float] = None,
- ) -> bytearray:
- ...
+ ) -> bytearray: ...
@overload
def read(
@@ -93,8 +91,7 @@ class Filesystem:
format: Literal["stream"],
user: Username = "user",
request_timeout: Optional[float] = None,
- ) -> Iterator[bytes]:
- ...
+ ) -> Iterator[bytes]: ...
def read(
self,
@@ -276,7 +273,9 @@ class Filesystem:
start_event = next(events)
if not start_event.HasField("start"):
- raise SandboxException("Failed to start watch: start event not found")
+ raise SandboxException(
+ f"Failed to start watch: expected start event, got {start_event}",
+ )
return WatchHandle(events=events)
except Exception as e:
diff --git a/packages/python-sdk/e2b/sandbox/process/main.py b/packages/python-sdk/e2b/sandbox/process/main.py
index a0c54bd7d..c9a490d85 100644
--- a/packages/python-sdk/e2b/sandbox/process/main.py
+++ b/packages/python-sdk/e2b/sandbox/process/main.py
@@ -115,8 +115,7 @@ class Process:
on_stderr: Optional[Callable[[str], None]] = None,
timeout: Optional[float] = 60,
request_timeout: Optional[float] = None,
- ) -> ProcessResult:
- ...
+ ) -> ProcessResult: ...
@overload
def run(
@@ -130,8 +129,7 @@ class Process:
on_stderr: Optional[Callable[[str], None]] = None,
timeout: Optional[float] = 60,
request_timeout: Optional[float] = None,
- ) -> ProcessHandle:
- ...
+ ) -> ProcessHandle: ...
def run(
self,
@@ -192,7 +190,9 @@ class Process:
start_event = next(events)
if not start_event.HasField("event"):
- raise SandboxException("Failed to start process: start event not found")
+ raise SandboxException(
+ f"Failed to start process: expected start event, got {start_event}"
+ )
return ProcessHandle(
pid=start_event.event.start.pid,
@@ -223,7 +223,7 @@ class Process:
if not start_event.HasField("event"):
raise SandboxException(
- "Failed to connect to process: start event not found"
+ f"Failed to connect to process: expected start event, got {start_event}"
)
return ProcessHandle(