public boolean isExternal() {
        Optional<Term> external = thisType.getAttribute("external");
        return external.isPresent() && (external.get() instanceof BooleanLiteral) && ((BooleanLiteral) external.get()).getValue();
    }
can be used to throw an exception from the template

@param message the message
@return the exception
code-generation/language-base-freemarker/src/main/java/org/apache/plc4x/plugins/codegenerator/protocol/freemarker/BaseFreemarkerLanguageTemplateHelper.java