Error Handling

Strict vs. non-strict exec, and the CommandError/SandboxError/ExecConnectionError types.

error-handling

Demonstrates the two error-handling modes for exec commands, and the error types you may encounter.

Setup

bunx alineo-cli init   # starts OpenSandbox in Docker (one-time setup)

Run

bun install
bun start

What it shows

PatternDescription
Non-strict execexec("...", { strict: false }) returns the result; you inspect exitCode yourself
Strict exec (default)Non-zero exit throws CommandError — catch it to handle the failure
Error typesCommandError, SandboxError, ExecConnectionError — when each is thrown

Two sandboxes run sequentially, one per pattern.