Function: functionRefusalOf()
@kortexya/reasoninglayer / functionRefusalOf
Function: functionRefusalOf()
Section titled “Function: functionRefusalOf()”functionRefusalOf(
error):FunctionRefusal|undefined
Defined in: src/utils/function-refusal.ts:49
Read the refusal of a function registration, evaluation, read, replacement or withdrawal from the error the SDK threw for it.
Parameters
Section titled “Parameters”unknown
What a catch received.
Returns
Section titled “Returns”FunctionRefusal | undefined
The refusal — status, code, message, the function and, on
function_has_callers, its callers — or undefined when error is not a
function refusal.
Throws
Section titled “Throws”Never. Anything that is not a function refusal answers undefined.
Remarks
Section titled “Remarks”The engine’s FunctionRefusalResponse ({error, code, message, function, callers?}).
The body is the raw wire (snake_case), so every field is read and checked; a
body that does not have the shape answers undefined. See
FunctionRefusalCode for every code.
Example
Section titled “Example”try { await client.functions.deleteFunction('discount');} catch (error) { const refusal = functionRefusalOf(error); if (refusal?.code === 'function_has_callers') { console.log(refusal.callers.map((c) => c.name)); } else throw error;}