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

(query driver []) throws a misleading exception #663

Closed
dgr opened this issue Sep 14, 2024 · 0 comments · Fixed by #664
Closed

(query driver []) throws a misleading exception #663

dgr opened this issue Sep 14, 2024 · 0 comments · Fixed by #664

Comments

@dgr
Copy link
Contributor

dgr commented Sep 14, 2024

Version
1.1.42

Platform
All

Symptom
Executing (query driver []) results in a clojure.lang.ArityException with a message that says Wrong number of args (1) passed to: etaoin.api/query.

Reproduction
See above.

Actual behavior
The exception and error message are misleading because they point to a mismatch between the arguments provided and the arity of the function. The error says that only one argument has been provided, when the user plainly sees two.

Expected behavior
The real error is that the vector argument (the query, q) is empty. The error message should reflect that.

Diagnosis
When query detects that q is a vector, is recursively calls (apply query driver q) to turn the vector into a variable number of arguments. When Clojure sees that q is empty, it tries to call (query driver), with arity of 1, which query doesn't support. The code should test whether q is an empty vector and throw an exception if so.

Action
I'll submit 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

Successfully merging a pull request may close this issue.

1 participant