Skip to content

Commit

Permalink
Merge pull request #611 from DAGWorks-Inc/issue-580
Browse files Browse the repository at this point in the history
Fixes up error messages to be clearer for missing keys in state expression
  • Loading branch information
VinciGit00 authored Aug 29, 2024
2 parents ceb522f + 25d8fd2 commit 8f056dd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scrapegraphai/nodes/base_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def get_input_keys(self, state: dict) -> List[str]:
self._validate_input_keys(input_keys)
return input_keys
except ValueError as e:
raise ValueError(f"Error parsing input keys for {self.node_name}: {str(e)}")
raise ValueError(f"Error parsing input keys for {self.node_name}") from e

def _validate_input_keys(self, input_keys):
"""
Expand Down Expand Up @@ -233,7 +233,7 @@ def evaluate_expression(expression: str) -> List[str]:
result = evaluate_expression(expression)

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

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

0 comments on commit 8f056dd

Please sign in to comment.