Execute the file in its engine.
The file to pass in as file f
into the child transaction.
Provide null or undefined to omit.
Additional options for the execution.
{
context: File,
request: File,
}
Optional. Context file to use within the child transaction. Defaults to the current transaction’s context.
Optional. Request file to use within the child transaction. Defaults to an empty file.
Execute the file in the engine defined by its type, in a new transaction, in an isolated VM.
Let’s assume the following form:
source.exec(f)
This form is more generic than f.call(method)
because source
does not need to be on the type chain of f
.
Note that no post-processing is performed, thus the result of
calling inline.exec(f)
will be slightly different
from calling f.inline()
which does apply some post-processing,
for example it extracts the body of the generated result
file,
passes on Content-Security-Policy rules, head entries and
updates the statusCode of the current transaction’s response file.
Execute a file without passing in an f
file.
Execute the .Inline
method of an app, returning
hello world
.
Execute a custom hello
source file that is not
on the type chain of f
. In this example, the
file f
has a broken type chain which is okay
here.
Increment a counter.
Request file defaults to a new, empty file.
Pass in custom request file.
Context file defaults to that of the current transaction.
Custom context file.
You can pass in undefined
to omit the file f
.
You can pass in null
to omit the file f
.
Unless f
is provided, it will always show up as
undefined
within the child exeuction context.
When the result contains an unhandled error, it will be thrown.
Here we catch it in a try-catch block.
Throws an error for unexpected options keys.
An error is thrown in a child execution context. Due to the unhandled error, the child transaction is rolled back.
The transaction is not rolled back merely by returning a non-success response, only if an unhandled error occurred.