Skip to content

Function: isOsfqlConstraintOverUnreadData()

@kortexya/reasoninglayer


@kortexya/reasoninglayer / isOsfqlConstraintOverUnreadData

Function: isOsfqlConstraintOverUnreadData()

Section titled “Function: isOsfqlConstraintOverUnreadData()”

isOsfqlConstraintOverUnreadData(error): error is OsfqlError

Defined in: src/errors.ts:426

Whether error is the OSFQL form of the bare refusal of a bound constraint over data the program’s writer may not read (reasoninglayer#1230).

unknown

Anything caught from an SDK call.

error is OsfqlError

true when error is an OsfqlError whose refusal.code is constraint_over_unread_data; false otherwise.

osfql.execute answers it as an execution failure (HTTP 422) when a CHECK ON axiom that reads data the writer may not read refuses an INSERT. The refusal names no bound, feature or constraint, and nothing of the program is written. The REST doors answer the same refusal as a ConstraintViolationError; test that one with isConstraintOverUnreadData.

try {
await client.osfql.execute('INSERT order(paid: 100, about: $account);');
} catch (e) {
if (isOsfqlConstraintOverUnreadData(e)) askSomeoneWhoCanReadTheRecord();
}