Version: v0.8.1 - Beta.  We welcome contributors & feedback.

Meta.failIfTemplateMode

Meta.failIfTemplateMode() -> null

Description

Trigger an exception if the current function was called from a template.

This helps prevent the app’s view-level logic from being tangled with your data-processing logic.

Data should be processed first, then passed into the template.

bodyHtml() //= ERROR

tem bodyHtml {
    {{ getData() }}
}

fun getData {
    Meta.failIfTemplateMode()
    // (generate and return data)
}

The following THT modules can not be called in template mode:

Db
Email
File
Input
Net
Output
Php
System