-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Ambiguous Less error #1728
Comments
You aren't closing your media query properly because you're missing a closing parenthesis.
|
Just in case, here's minimal code to get the same error:
|
Sorry, I was reading this as you asking why you were getting the error, not that the error message was ambiguous. My bad. |
I guess it's the same for 1.4.x - 1.5.x |
Another interesting snippet (not the same but related):
result:
I guess in all these cases compiler expects some "query" to go right after |
Yeah, an "invalid selector" or "invalid query" might be a good error to raise. |
OK, I was almost about to submit a patch that improves the error message but then I looked into w3c docs to find out what error message it's better to be ("expected media type or media features expression" or so) and stepped into this:
And though it does not say that
Quite surprising, i.e. |
The performance improvements I am merging in will now error on unclosed |
@lukeapage, mediaFeature handles its outer parens on its own, will this be affected by the "performance improvements" changes? (After all we will always can simply give up |
No the changes affect the tokeniser s the bug would still happen in the |
OK, either way I think I'll wait for the performance improvements to appear in the master. (So far I'm not happy with my attempts to fix it to handle both |
It's unfortunate that there isn't a clearer message whilst having issues parsing There's a few try/catch blocks in parser.js which are immediately wrapping in-built errors (e.g. The problem is that when these errors are getting reported: The The code is slightly different in index.js but it serves the same purpose. It should be possible to make this error reporting more robust for in-built errors.
Thoughts? |
Stack trace? I doubt a stack trace of the compiler code will be helpful to understand a error of a LESS code. (Though it might be useful for the compiler development itself as sometimes it's really hard to find where some "unexpected in line: null column: 0" comes from). |
There's 2 issues here:
It's great if you can fix every single parsing error that occurs so that a helpful message can be displayed. Assuming that the parser is fairly robust, the frequency of these programmatic errors should be rare, so the appearance of stack traces to end-users should be rare too. |
Also, for interest sake, here's the stack trace when you have
|
this particular issue is fixed now. there is a test for it. I've been slowly improving error reporting since I started contributing and there are extra things we could do and I welcome any pull requests to improve that. |
The following LESS code generates a pretty unhelpful error (missing closing parenthesis on media query).
The text was updated successfully, but these errors were encountered: