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

Improve "Undeclared Path X" error message #33

Closed
cowwoc opened this issue Oct 19, 2011 · 8 comments
Closed

Improve "Undeclared Path X" error message #33

cowwoc opened this issue Oct 19, 2011 · 8 comments

Comments

@cowwoc
Copy link
Contributor

@cowwoc cowwoc commented Oct 19, 2011

I've recently started seeing "Undeclared Path X" error messages when issuing queries. I eventually tracked it down to the fact that I was referencing an SQL variable in my query that was not being passed into the SQLQueryImpl constructor.

I found the error message to be confusing. I suggest providing more information about what is actually wrong, such as:

Query refers to undeclared variable "X". Please declare it in the SQLQueryImpl constructor.
  1. The variable name should be quoted, to make it obvious we're talking about a user-declared variable
  2. The error message should suggest how to fix the problem.
timowest added a commit that referenced this issue Oct 19, 2011
@timowest
Copy link
Member

@timowest timowest commented Oct 19, 2011

Here is the new error message :

throw new IllegalArgumentException("Undeclared path '" + expr.getRoot() + "'. " +
"Add this path as a source to the query to be able to reference it.");

I couldn't make it SQL specific, since this behaviour is general.

@timowest
Copy link
Member

@timowest timowest commented Oct 23, 2011

Released in 2.2.4

@timowest timowest closed this Oct 23, 2011
@stephaneeybert
Copy link

@stephaneeybert stephaneeybert commented Oct 26, 2014

Even the new wording leaves me puzzled. But that's me.

@timowest
Copy link
Member

@timowest timowest commented Oct 26, 2014

How does your query code look like?

@stephaneeybert
Copy link

@stephaneeybert stephaneeybert commented Oct 26, 2014

@timowest Hi, thanks for the interest, I published my code on SO http://stackoverflow.com/questions/26568576/undeclared-path-on-querydsl

@timowest
Copy link
Member

@timowest timowest commented Oct 26, 2014

@stephaneeybert What kind of change would you propose to the error message?

@stephaneeybert
Copy link

@stephaneeybert stephaneeybert commented Oct 26, 2014

For now my understanding of the path handling and the join mechanism is not enough to suggest a better message. In fact, looking at the 2.1.8. General usage section of the reference documentation, I have several questions for clarification points. For example:
from: Add the query sources here. <--- What is a query source and when would we need several in there ?
innerJoin, join, leftJoin, fullJoin, on: Add join elements using these constructs. For the join methods the first argument is the join source and the second the target (alias). <--- What is a join source ? Is it different than the above query source ?

@stephaneeybert
Copy link

@stephaneeybert stephaneeybert commented Oct 26, 2014

The 2.1.7 section of the reference documentation displays a use of joins with an on() method. This is news to me. I always used it without the on() method. When to use it ? And when not having to ?

jwgmeligmeyling pushed a commit that referenced this issue Dec 28, 2020
Fix syntax error in method with return type in ScalaWriter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants