Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes up error messages to be clearer for missing keys in state expression #611

Merged
merged 1 commit into from
Aug 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading