Skip to main content

Error Codes

BoxliteErrorCode

All API functions return BoxliteErrorCode to indicate success or failure type:

Error Code Reference

CBoxliteError

Detailed error information for debugging:
Always initialize CBoxliteError with zero: CBoxliteError error = {0};. The struct is stack-allocated, but the message field points to heap memory that must be freed with boxlite_error_free().

Error Handling Functions

boxlite_error_free

Free error struct (message only - struct itself is stack-allocated).
Safe to call with NULL. After calling, the message field is set to NULL.

Error Handling Patterns

Pattern 1: Basic Check

Pattern 2: Switch on Error Code

Pattern 3: Retry Logic

Some error codes like InvalidArgument and Unsupported indicate permanent failures that should not be retried. Check the error code before retrying.

Pattern 4: Cleanup on Error

Metrics

boxlite_runtime_metrics

Get runtime-wide metrics as JSON.

Parameters

Example Output

Runtime Metrics Fields

Example

boxlite_box_metrics

Get per-box metrics as JSON.

Parameters

Example Output

Box Metrics Fields

Example

Complete Metrics Example