Skip to content

Function: isConstraintOverUnreadData()

@kortexya/reasoninglayer


@kortexya/reasoninglayer / isConstraintOverUnreadData

isConstraintOverUnreadData(error): error is ConstraintViolationError

Defined in: src/errors.ts:280

Whether error is the one bare refusal of a bound constraint over data the caller may not read (reasoninglayer#1230, #1235).

unknown

Anything caught from an SDK call.

error is ConstraintViolationError

true when error is a ConstraintViolationError whose code is constraint_over_unread_data; false otherwise, for any other 409 included.

The REST write doors answer it as a 409: POST /api/v1/terms, PUT /api/v1/terms/{id}, POST /api/v1/terms/bulk, POST /api/v1/inference/facts and POST /api/v1/actions/apply (an edit the action puts, and its conditional replacement). OSFQL answers the same refusal as an OsfqlError instead; test that one with isOsfqlConstraintOverUnreadData.

try {
await client.terms.updateTerm(termId, { features: { paid: 100 } });
} catch (e) {
if (isConstraintOverUnreadData(e)) askSomeoneWhoCanReadTheRecord();
}