Improve "Undeclared Path X" error message #33

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

Comments

Projects
None yet
3 participants
@cowwoc
Contributor

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

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Oct 19, 2011

Member

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.

Member

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

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Oct 23, 2011

Member

Released in 2.2.4

Member

timowest commented Oct 23, 2011

Released in 2.2.4

@timowest timowest closed this Oct 23, 2011

@stephaneeybert

This comment has been minimized.

Show comment
Hide comment
@stephaneeybert

stephaneeybert Oct 26, 2014

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

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

@timowest

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Oct 26, 2014

Member

How does your query code look like?

Member

timowest commented Oct 26, 2014

How does your query code look like?

@stephaneeybert

This comment has been minimized.

Show comment
Hide comment
@timowest

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Oct 26, 2014

Member

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

Member

timowest commented Oct 26, 2014

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

@stephaneeybert

This comment has been minimized.

Show comment
Hide comment
@stephaneeybert

stephaneeybert 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 ?

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

This comment has been minimized.

Show comment
Hide comment
@stephaneeybert

stephaneeybert 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 ?

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 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment