Skip to content

Function: errorBodyRefs()

@kortexya/reasoninglayer


@kortexya/reasoninglayer / errorBodyRefs

errorBodyRefs(error): Record<string, string> | undefined

Defined in: src/utils/error-code.ts:107

The records an engine error body names by role, from an ApiError’s body.

unknown

Anything caught from an SDK call.

Record<string, string> | undefined

The body’s refs map (role → term id) without its non-string entries, or undefined when the error is not an ApiError or its body carries no refs object.

The engine’s coded body { error, code, message, refs } names the records a client acts on: dependant for dependant_changed_concurrently (reasoninglayer#1245), term for term_changed_concurrently (#1263), passage and passage_review for source_passage_unconfirmed. Branch on errorBodyCode, then read the role that code documents.

try {
await client.terms.updateTerm(accountId, { features: { limit: 3 } });
} catch (error) {
if (errorBodyCode(error) === 'dependant_changed_concurrently') {
console.log('changed meanwhile:', errorBodyRefs(error)?.dependant);
}
}