This page covers BoxLite’s error types for structured error handling and the metrics API for monitoring runtime and per-box resource usage.
Error Types
Exception Hierarchy
BoxliteError
Base error class for all BoxLite errors. All specific error types extend this class.
Always catch BoxliteError as a fallback when you want to handle any BoxLite-specific error generically.
ExecError
Command execution failed (non-zero exit code).
TimeoutError
Operation exceeded time limit.
ParseError
Failed to parse command output.
Comprehensive Error Handling
Here is a pattern for handling all BoxLite error types:
Metrics
BoxLite provides two levels of metrics: runtime-wide metrics and per-box metrics.
JsRuntimeMetrics
Runtime-wide metrics covering all boxes managed by a runtime instance.
JsBoxMetrics
Per-box resource metrics for monitoring individual box usage.
Counter Fields
Resource Fields
Timing Fields (milliseconds)
Example
Monitoring Dashboard Example
Here is a more complete example that polls both runtime and box metrics: