Skip to content

Commit

Permalink
Fixes node expression validator error message to make it easier to de…
Browse files Browse the repository at this point in the history
…bug missing keys
  • Loading branch information
elijahbenizzy committed Aug 29, 2024
1 parent ceb522f commit 25d8fd2
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 25d8fd2

Please sign in to comment.