Skip to content

Commit 8f056dd

Browse files
authored
Merge pull request #611 from DAGWorks-Inc/issue-580
Fixes up error messages to be clearer for missing keys in state expression
2 parents ceb522f + 25d8fd2 commit 8f056dd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

scrapegraphai/nodes/base_node.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def get_input_keys(self, state: dict) -> List[str]:
113113
self._validate_input_keys(input_keys)
114114
return input_keys
115115
except ValueError as e:
116-
raise ValueError(f"Error parsing input keys for {self.node_name}: {str(e)}")
116+
raise ValueError(f"Error parsing input keys for {self.node_name}") from e
117117

118118
def _validate_input_keys(self, input_keys):
119119
"""
@@ -233,7 +233,7 @@ def evaluate_expression(expression: str) -> List[str]:
233233
result = evaluate_expression(expression)
234234

235235
if not result:
236-
raise ValueError("No state keys matched the expression.")
236+
raise ValueError(f"No state keys matched the expression. Expression was {expression}. State contains keys: {', '.join(state.keys())}")
237237

238238
# Remove redundant state keys from the result, without changing their order
239239
final_result = []

0 commit comments

Comments
 (0)