Skip to content

Commit 7d8b218

Browse files
authored
Merge pull request #504 from rgstephens/colang-syntax-msg
Add colang 2.0 syntax error details
2 parents 65649b6 + 06e5d29 commit 7d8b218

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,5 @@ eval_outputs
3030
local_cache
3131
# Ignore example configs created in user guides
3232
docs/user_guides/llm/vertexai/config
33+
# vscode local history extension
34+
.history

nemoguardrails/colang/v2_x/lang/expansion.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,9 @@ def _expand_await_element(
475475
)
476476
)
477477
else:
478-
raise ColangSyntaxError(f"Unsupported spec type '{type(element.spec)}'")
478+
raise ColangSyntaxError(
479+
f"Unsupported spec type '{type(element.spec)}', element '{element.spec.name}' on line {element._source.line}"
480+
)
479481
else:
480482
# Element group
481483
normalized_group = normalize_element_groups(element.spec)
@@ -611,7 +613,7 @@ def _expand_activate_element(
611613
else:
612614
# It's an UMIM event
613615
raise ColangSyntaxError(
614-
f"Only flows can be activated but not '{element.spec.spec_type}'!"
616+
f"Only flows can be activated but not '{element.spec.spec_type}', element '{element.spec.name}' on line {element._source.line}!"
615617
)
616618
elif isinstance(element.spec, dict):
617619
# Multiple match elements

0 commit comments

Comments
 (0)