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

When parameter's type is incorrect, print the type of the parameter, not its value #598

Open
rbpasker opened this issue Jul 29, 2024 · 1 comment

Comments

@rbpasker
Copy link

should be
), f"Wrong kind of query parameters found: {type(query_params)}"

), f"Wrong kind of query parameters found: {query_params}"

@HenryL27
Copy link
Collaborator

I think this gives you both pieces of information - query_params are typically dataclasses, which get a repr method like DuckDBQueryParams(table_name=blah, query=blah, create_hnsw_table=blah)... although I guess in this case we're getting one of the other ReaderQueryParams.
I like to err on the side of putting too much information in error messages rather than too little. That said there may be cases where the type doesn't get reported - e.g. if you override the repr / str method or pass in some other kind of object. Nonetheless users typically won't be interacting with this api - the assert mostly exists for typechecking.

If you want to change this, go ahead an open a PR!

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

No branches or pull requests

2 participants