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

Fix TypeError in convert function when schema is not a class #140

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

philippwaller
Copy link

Currently, when an incorrect type is passed for the schema parameter in the convert function, a TypeError occurs before reaching the final exception handling logic. This is especially problematic when the convert function is used recursively, as it makes debugging more challenging by failing to provide meaningful error messages.

Example of the Issue

File "/home-assistant/home-assistant-core/venv/lib/python3.13/site-packages/voluptuous_serialize/__init__.py", line 40, in convert
    pval = convert(value, custom_serializer=custom_serializer)
  File "/home-assistant/home-assistant-core/venv/lib/python3.13/site-packages/voluptuous_serialize/__init__.py", line 120, in convert
    if issubclass(schema, Enum):
       ~~~~~~~~~~^^^^^^^^^^^^^^
TypeError: issubclass() arg 1 must be a class

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant