Skip to content

Function: isDependantNotWritable()

@kortexya/reasoninglayer


@kortexya/reasoninglayer / isDependantNotWritable

isDependantNotWritable(error): error is ConstraintViolationError

Defined in: src/errors.ts:340

Whether error is the refusal of a write whose dependant the caller may not write as adjusted (reasoninglayer#1245, #1251).

unknown

Anything caught from an SDK call.

error is ConstraintViolationError

true when error is a ConstraintViolationError whose code is dependant_not_writable; false otherwise.

An update bound constraint of a term that reads the written feature would adjust that term, and the caller reads it but may not write it. ConstraintViolationError.termId names that term, not the written one; the message names the guard that refused it. Nothing is written. The same doors as isDependantsExceedCommitBudget answer it.

try {
await client.terms.updateTerm(accountId, { features: { limit: 3 } });
} catch (e) {
if (isDependantNotWritable(e)) askTheOwnerOf(e.termId);
}