Skip to content

Function: isOsfqlTermChangedConcurrently()

@kortexya/reasoninglayer


@kortexya/reasoninglayer / isOsfqlTermChangedConcurrently

Function: isOsfqlTermChangedConcurrently()

Section titled “Function: isOsfqlTermChangedConcurrently()”

isOsfqlTermChangedConcurrently(error): error is OsfqlError

Defined in: src/errors.ts:454

Whether error is the OSFQL answer to a lost commit: another writer changed a term the program read before the program committed (reasoninglayer#1268).

unknown

Anything caught from an SDK call.

error is OsfqlError

true when error is an OsfqlError whose errorType is term_changed_concurrently; false otherwise.

osfql.execute answers it with HTTP 409; the message names the term. Nothing of the program is written, and reading again and retrying is safe. The other program doors (cypher, gql, gremlin, the ontology import, scenarios, …) answer the same conflict as the coded 409 body; test that one with isTermChangedConcurrently.

try {
await client.osfql.execute('UPDATE order(id: 1) SET paid: 3;');
} catch (e) {
if (isOsfqlTermChangedConcurrently(e)) retry();
}