Skip to content

Commit

Permalink
Merge pull request #5 from alexharv074/ah/4-fail-gracefully
Browse files Browse the repository at this point in the history
[Resolve #4] Fail gracefully on bad input
  • Loading branch information
alex-harvey-z3q authored Jun 19, 2024
2 parents c8717c5 + adae6bf commit ff8751a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 28 deletions.
6 changes: 6 additions & 0 deletions jinja_unquote_resolvers_filter/unquote_resolvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ def _(item: Dict) -> Dict:
def _(item: List) -> List:
return [process_item(value) for value in item]

if not isinstance(data, (dict, list)):
raise TypeError(
"unquote_resolvers - Input data must be a dict or a list, but got %s"
% type(data).__name__
)

processed_data = process_item(data)

try:
Expand Down
43 changes: 16 additions & 27 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ classifiers = [
]

[tool.poetry.dependencies]
types-PyYAML = "^6.0.12"
pyyaml = "^6.0"
python = "^3.8"
Jinja2 = "^3.1.2"

Expand Down

0 comments on commit ff8751a

Please sign in to comment.