Skip to main content

Class: SandboxViolationError

Defined in: src/types/errors.ts:561

Sandbox security violation error.

Remarks​

Thrown when a plugin violates security constraints enforced by the isolated-vm sandbox. This includes network access violations, storage quota exceeded, CPU timeout, memory limit exceeded, or unauthorized hook access.

Example​

throw new SandboxViolationError(
'com.example.plugin',
'MEMORY',
'Plugin exceeded 128MB memory limit'
);

Extends​

Constructors​

new SandboxViolationError()​

new SandboxViolationError(pluginId, violationType, message): SandboxViolationError

Defined in: src/types/errors.ts:581

Creates a new SandboxViolationError.

Parameters​

pluginId​

string

ID of the plugin that violated sandbox rules

violationType​

SandboxViolationType

Type of violation ('NETWORK', 'STORAGE', 'CPU', 'MEMORY', 'HOOK')

message​

string

Description of the violation

Returns​

SandboxViolationError

Overrides​

ChiveError.constructor

Properties​

cause?​

readonly optional cause: Error

Defined in: src/types/errors.ts:71

Original error that caused this error (if any).

Remarks​

Error chaining allows tracking the full error context through multiple layers of the application. Useful for debugging complex error scenarios.

Example​

try {
await fetchData();
} catch (err) {
throw new ValidationError('Failed to validate data', 'field', 'required', err as Error);
}

Inherited from​

ChiveError.cause


code​

readonly code: "SANDBOX_VIOLATION" = 'SANDBOX_VIOLATION'

Defined in: src/types/errors.ts:562

Machine-readable error code.

Remarks​

Error codes are unique identifiers for error types, enabling programmatic error handling (switch statements, error maps), error tracking in monitoring systems, and client-side error translation (i18n).

Overrides​

ChiveError.code


pluginId​

readonly pluginId: string

Defined in: src/types/errors.ts:567

ID of the plugin that violated sandbox rules.


violationType​

readonly violationType: SandboxViolationType

Defined in: src/types/errors.ts:572

Type of sandbox violation.