Skip to content

Commit

Permalink
bugfix in filter_needs
Browse files Browse the repository at this point in the history
  • Loading branch information
big1hc committed Aug 9, 2023
1 parent c73c44f commit 1335b7e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions sphinx_needs/filter_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,11 @@ def filter_single_need(
result = bool(eval(filter_compiled, filter_context))
else:
result = bool(eval(filter_string, filter_context))
if result not in (True, False):
# Raises NeedsInvalidFilter if the result is not equal True/False
raise NeedsInvalidFilter(
f"Error when evaluating filter: expected output to have True/False but got a result <{result}>"
)
except Exception as e:
raise NeedsInvalidFilter(f"Filter {filter_string} not valid. Error: {e}.")
return result

0 comments on commit 1335b7e

Please sign in to comment.