jlongster/nunjucks — pull request #27 by devoidfury (2012-11-16 21:40:07+00:00)
Title: begin implementing cleaner errors discussed in #16

I've begun making the error handling change.

The changes so far:
- Fixed bug where lineno+colno wouldn't show if either were '0' (first row)
- the trace it throws should be more relevant to users of the library
- best case scenario looks like this:

Template render error: (/Users/devoidfury/nunjucks/test.html) [Line 1, Column 26]
parseExtends: string or value expected
at Object.extend.render (/Users/devoidfury/nunjucks/src/environment.js:259:21)
at render (/Users/devoidfury/nunjucks/tests/util.js:9:14)
at Object. (/Users/devoidfury/nunjucks/tests/test.js:4:5)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.runMain (module.js:492:10)
at process.startup.processNextTick.process._tickCallback (node.js:244:9)

- Worst case scenario looks like this:

Template render error - ReferenceError: (unknown path)
x is not defined
at Object.extend.render (/Users/devoidfury/nunjucks/src/environment.js:259:21)
at render (/Users/devoidfury/nunjucks/tests/util.js:9:14)
at Object. (/Users/devoidfury/nunjucks/tests/test.js:4:5)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.runMain (module.js:492:10)
at process.startup.processNextTick.process._tickCallback (node.js:244:9)

One important thing to note is the `development` parameter to Environment, but it's commented.