diff --git a/.changelog/43.fixed.md b/.changelog/43.fixed.md new file mode 100644 index 0000000..13c163e --- /dev/null +++ b/.changelog/43.fixed.md @@ -0,0 +1,2 @@ +Don't swallow exceptions which are not related to absence of def blocks in feature template files +Fixed condition in the unreal feature which would not render additional functions if there was no automation config in the yaml \ No newline at end of file diff --git a/src/generator/core/base_feature.py b/src/generator/core/base_feature.py index ab15ac1..dfded0d 100644 --- a/src/generator/core/base_feature.py +++ b/src/generator/core/base_feature.py @@ -76,9 +76,10 @@ def render_blocks(self, context: TemplateContext, template_lookup: TemplateLooku try: block = self.render_block(block_type, context, template) block_value.append(block) - except AttributeError: # as e: - # print(e) - # Block not defined in template - that's OK + except AttributeError as e: + # If the exception message matches the condition below, it means that the block is not defined in template - that's OK + if f"has no attribute 'render_{block_type}'" not in str(e): + raise e pass except Exception as e: logger.error("Error rendering %s for %s : %s", block_type, self.feature_name, e, exc_info=e) diff --git a/src/generator/templates/unreal.mako b/src/generator/templates/unreal.mako index 4644c66..7554a23 100644 --- a/src/generator/templates/unreal.mako +++ b/src/generator/templates/unreal.mako @@ -85,12 +85,12 @@ ${feature_config._accumulator['buildgraph_properties']} } def executeAutomationScript(String scriptName, String arguments) { - % if feature_config.automation.logs_folder: + % if feature_config.automation and feature_config.automation.logs_folder: def logFolder = "${feature_config.automation.logs_folder}" <%text>withEnv( ["uebp_LogFolder=${logFolder}"] ) { % endif executePythonScript(scriptName, arguments) - % if feature_config.automation.logs_folder: + % if feature_config.automation and feature_config.automation.logs_folder: } % endif }