Skip to main content

Class: ComplianceError

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

AT Protocol compliance violation error.

Remarks​

Thrown when code attempts to violate AT Protocol AppView principles:

  • Writing to user PDSes (forbidden)
  • Storing blob data instead of BlobRefs (forbidden)
  • Creating non-rebuildable indexes (forbidden)
  • Missing PDS source tracking (required)

These errors indicate critical bugs that must be fixed before release. All compliance violations should be caught by automated tests.

Example​

if (operation === 'WRITE_TO_PDS') {
throw new ComplianceError(
'WRITE_TO_PDS',
'AppViews must never write to user PDSes'
);
}

Extends​

Constructors​

new ComplianceError()​

new ComplianceError(violationType, message): ComplianceError

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

Creates a new ComplianceError.

Parameters​

violationType​

Specific type of compliance violation

"WRITE_TO_PDS" | "BLOB_STORAGE" | "MISSING_SOURCE_TRACKING" | "NON_REBUILDABLE"

message​

string

Description of the violation

Returns​

ComplianceError

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: "COMPLIANCE_VIOLATION" = 'COMPLIANCE_VIOLATION'

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

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


violationType​

readonly violationType: "WRITE_TO_PDS" | "BLOB_STORAGE" | "MISSING_SOURCE_TRACKING" | "NON_REBUILDABLE"

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

Type of compliance violation.

Remarks​

Specific violation types enable targeted error handling and reporting.