8lueberry / express-dot-engine

Node.js engine using the ultra fast doT templating with support for layouts, partials and friendly for front-end web libraries (Angular, Ember, Backbone...)
MIT License
43 stars 10 forks source link

Give location for rendering error #19

Closed ghost closed 5 years ago

ghost commented 9 years ago

I'm currently moving some existing code from some nasty stand-alone wrappers for Dot to use the express engine instead. Sometimes when I convert a file I get an error

/Users/jacob/Dev/work/cloud/node_modules/express-dot-engine/index.js:372
  str.replace(settings.config, function(m, conf) {
      ^
TypeError: Cannot call method 'replace' of undefined
    at builtTemplateFromString (/Users/jacob/Dev/work/cloud/node_modules/express-dot-engine/index.js:372:7)
    at done (/Users/jacob/Dev/work/cloud/node_modules/express-dot-engine/index.js:323:19)
    at /Users/jacob/Dev/work/cloud/node_modules/express-dot-engine/index.js:355:7
    at fs.js:271:14
    at Object.oncomplete (fs.js:107:15)

Preceeding this stack is the entire stringified dot template that I'm trying to render into. There really needs to be some kind of marker so that I know which template item in the file is failing to render correctly. Some of these files are large with a lot of templating in them and trying to track this down is almost impossible.

mihaislobozeanu commented 8 years ago

Hi,

Please check my fork ( https://github.com/mihaislobozeanu/express-dot-engine ). I've made some changes and you have on error the exact template that fails.

cjsturgess commented 5 years ago

Covered in #25.