Skip to content

Build AI methods with your coding agent, then run them anywhere: as an MCP for chatbots, as a webapp for people, or via API for your software.

fix: remove dead TemplateSigilSyntaxError catches (#897)

Louis Choquel340d73074e0d
diff --git a/pipelex/cogt/templating/template_blueprint.py b/pipelex/cogt/templating/template_blueprint.py
index a737dc2d2..7554dc6b8 100644
--- a/pipelex/cogt/templating/template_blueprint.py
+++ b/pipelex/cogt/templating/template_blueprint.py
@@ -3,7 +3,6 @@ from typing import Any
from pydantic import BaseModel, Field, model_validator
from pipelex.cogt.templating.template_category import TemplateCategory
-from pipelex.cogt.templating.template_errors import TemplateSigilSyntaxError
from pipelex.cogt.templating.template_preprocessor import preprocess_template
from pipelex.cogt.templating.templating_style import TemplatingStyle
from pipelex.tools.jinja2.jinja2_errors import Jinja2TemplateSyntaxError
@@ -21,11 +20,7 @@ class TemplateBlueprint(BaseModel):
@model_validator(mode="after")
def validate_template(self) -> "TemplateBlueprint":
- try:
- preprocessed = preprocess_template(self.template)
- except TemplateSigilSyntaxError as exc:
- msg = f"Template sigil error in TemplateBlueprint: {exc}"
- raise ValueError(msg) from exc
+ preprocessed = preprocess_template(self.template)
try:
check_jinja2_parsing(template_source=preprocessed, template_category=self.category)
except Jinja2TemplateSyntaxError as exc:
diff --git a/pipelex/pipe_operators/compose/construct_blueprint.py b/pipelex/pipe_operators/compose/construct_blueprint.py
index 87f25dbb2..373f2e275 100644
--- a/pipelex/pipe_operators/compose/construct_blueprint.py
+++ b/pipelex/pipe_operators/compose/construct_blueprint.py
@@ -13,7 +13,6 @@ from typing import Any, cast
from pydantic import BaseModel, ConfigDict, SerializationInfo, SerializerFunctionWrapHandler, field_validator, model_serializer, model_validator
from pipelex.cogt.templating.template_category import TemplateCategory
-from pipelex.cogt.templating.template_errors import TemplateSigilSyntaxError
from pipelex.cogt.templating.template_preprocessor import preprocess_template
from pipelex.pipe_operators.compose.exceptions import ConstructFieldBlueprintTypeError, ConstructFieldBlueprintValueError
from pipelex.tools.jinja2.jinja2_errors import Jinja2DetectVariablesError
@@ -245,11 +244,7 @@ class ConstructBlueprint(BaseModel):
case ConstructFieldMethod.TEMPLATE:
if field_blueprint.template:
# Use the same approach as template mode: preprocess then detect variables
- try:
- preprocessed = preprocess_template(field_blueprint.template)
- except TemplateSigilSyntaxError as exc:
- msg = f"Template sigil error in construct template: {exc}"
- raise ValueError(msg) from exc
+ preprocessed = preprocess_template(field_blueprint.template)
try:
template_vars = detect_jinja2_required_variables(
template_category=TemplateCategory.BASIC,