Function Invocations

These events occur when a function is about to be executed or has finished executing.

preFunctionInvoke

This event is triggered before a function is invoked. It allows you to perform actions or modifications before the function execution begins.

Data Structure

Data Key
Type
Description

arguments

ArgumentsScope

The arguments scope

context

IBoxContext

The BoxLang Request context

function

Function

The UDF/Function/Closure/Lambda invoked

name

String

The name of the function invoked

Example

cass myListener{

	function preFunctionInvoke( struct data ){
		// Access the function name
		var functionName = data.name;
		
		// Log the function invocation
		log.info("Function invoked: " & functionName);
		
		// You can modify arguments if needed
		data.arguments.set("newArg", "value");
	}
}

postFunctionInvoke

This event is triggered after a function has been invoked. It allows you to perform actions or modifications after the function execution has completed.

Data Structure

Data Key
Type
Description

arguments

ArgumentsScope

The arguments scope

context

IBoxContext

The BoxLang Request context

function

Function

The UDF/Function/Closure/Lambda invoked

name

String

The name of the function invoked

result

Any

The result of the function call

Example

onFunctionException

This event is triggered when an exception occurs during the function invocation. It allows you to handle exceptions gracefully.

Data Structure

Data Key
Type
Description

arguments

ArgumentsScope

The arguments scope

context

IBoxContext

The BoxLang Request context

function

Function

The UDF/Function/Closure/Lambda invoked

name

String

The name of the function invoked

exception

Exception

The exception that occurred during the function invocation

Example

Last updated

Was this helpful?