cloudhead/less.js — comment on commit aefd31051476ccac82ec581ab8ac80ed6c2c5575
File:  line 0
By paulogaspar7:

When running from the command prompt, from this commit on, a syntax error on an import is producing a big exception like this:

TypeError: Cannot call method 'charAt' of undefined
at getLocation (/some-dir/less.js/lib/less/parser.js:204:34)
at new LessError (/some-dir/less.js/lib/less/parser.js:213:19)
at Object.toCSS (/some-dir/less.js/lib/less/parser.js:379:31)
at /some-dir/less.js/bin/lessc:103:28
at /some-dir/less.js/lib/less/parser.js:428:40
at /some-dir/less.js/lib/less/parser.js:94:48
at /some-dir/less.js/lib/less/index.js:113:15
at /some-dir/less.js/lib/less/parser.js:428:40
at /some-dir/less.js/lib/less/parser.js:94:48
at /some-dir/less.js/lib/less/index.js:113:15

This happens because the getLocation() function is called for an undefined "input" argument.

The degradation of reporting syntax errors at imported files when running "lessc" started already with a first step at commit "6d4516e6fc". Since that commit:
* if I introduce a syntax error on a first imported less file...
* ...which causes an "undefined variable" error on a second imported less file...
* ...only this second error gets reported.

Before commit ""6d4516e6fc", both errors would be reported by "lessc", as I already reported at:
* https://github.com/cloudhead/less.js/commit/6d4516e6fcc6a84cbaf5db9e5753d05787a28937

I have been tweaking with the code and managed to have a version reporting both errors, but my current solution is awful, as nothing to do with version 1.2.0 code (which ran ok) and therefore, I am pretty sure there is a better way to do it.

Cheers!