`less.render` callback does not print any syntax or other errors
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 17k
- Forks
- 3.4k
- Avg merge
- 7h 42m
- Merged PRs (30d)
- 26
Description
Hi all.
I have observed an odd behaviour in less.render callback where program execution stops on any error in the callback scope but it does not print any trace or any error whatsoever.
I have been unable to trace the issue, I am unsure if this is language semantics (use of try and catch statements), if it is node.js issue or the less.js library. I understand there are workarounds and possible solutions but regardless I don't believe this expected behaviour. The behaviour is more odd that it depends on the less contents provided. The callback (in both scenarios attached) is provided with a 'truthy' error from less.js but the callback scope behaves differently (one stops execution, the other does not).
Can anyone see what's going on wrong? I have attached two .js one that works test-working.js and one that reproduces the issue test-failing.js.
Forgive me if I have missed something obvious, it has been while since I used node.
Code for test-working.js: https://gist.github.com/kwketh/b64bbf3994445e2b9c27
Output:
$ node test-working.js
callback works as expected, error will be thrown.
/Users/kwketh/[ ... ]/test-working.js:6
callUndefinedFunction()
^
ReferenceError: callUndefinedFunction is not defined
...
Code for test-failing.js: https://gist.github.com/kwketh/4c3c47308d619a640db1
Output:
$ node test-failing.js
callback works but does not display any errors.
Many thanks.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the attached test-working.js and test-failing.js examples with Node.js and compare their callback behavior and output. Then trace the less.render callback path and error handling in the less.js source. Done means the differing examples have an explained and reproducible result, with errors reported consistently or the behavior documented if it is expected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100