SandboxError.
Error classes
Each
SandboxError includes:
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Error classes raised by the porter-sandbox TypeScript Sandbox SDK
SandboxError.
import {
AuthenticationError,
NotFoundError,
RateLimitError,
SandboxError,
SandboxTimeoutError,
ServerError,
} from "porter-sandbox";
| Error | Raised when |
|---|---|
SandboxError | Base class for SDK-raised API errors. |
AuthenticationError | The API rejects credentials. |
NotFoundError | A sandbox, volume, or other resource cannot be found. |
RateLimitError | The API returns a rate limit response. |
ServerError | The API returns a server-side error. |
SandboxTimeoutError | A request exceeds its timeout. Never retried, since the server may still be executing the request. |
SandboxError includes:
| Property | Type | Description |
|---|---|---|
message | string | Human-readable error message. |
statusCode | number | null | HTTP status code, when available. |
body | unknown | Parsed response body, when available. |
import { Porter, SandboxError } from "porter-sandbox";
const porter = new Porter();
const sandbox = await porter.sandboxes.create({ image: "python:3.12-slim" });
try {
const result = await sandbox.exec(["python", "-c", "raise SystemExit(2)"]);
if (result.exit_code !== 0) {
console.error(result.stderr);
}
} catch (error) {
if (error instanceof SandboxError) {
console.error(`Sandbox API error: ${error.message}`);
} else {
throw error;
}
} finally {
await sandbox.terminate();
porter.close();
}
