Skip to content
Browse files

format error report

  • Loading branch information...
1 parent 4c80d66 commit 131f2691c01994cc79625e27112a3a72859c8f8a @jindw committed May 3, 2014
Showing with 13 additions and 10 deletions.
  1. +6 −5 lite-engine.js
  2. +1 −1 package.json
  3. +2 −3 parse/extension-parser.js
  4. +1 −0 parse/extension.js
  5. +1 −0 parse/parse-context.js
  6. +2 −1 process.js
View
11 lite-engine.js
@@ -47,7 +47,6 @@ LiteEngine.prototype.onChange = function(path,code,config) {
doRender.apply(null,args)
}
}
- }else if(){
}else{//clear cache
delete this.templateMap[path];
console.info('clear template cache:' ,path);
@@ -89,7 +88,8 @@ function doRender(tpl,model,response){
try{
var rtv = tpl.render(model);
}catch(e){
- rtv = require('util').inspect(e,true);
+ rtv = '<pre>'+require('util').inspect(e,true)+'\n\n'+(e.message +e.stack);
+ //throw e;
}
response.end(rtv);
}
@@ -99,17 +99,18 @@ function renderAsync(tpl,modelLoader,response){
try{
var rtv = tpl.render(model);
}catch(e){
- rtv = require('util').inspect(e,true);
+ rtv = require('util').inspect(e,true)+'\n\n'+(e.message +e.stack);
}
response.end(rtv);
});
}
function Template(code,config,staticPrefix){
//console.log(code)
+
try{
- this.impl = eval('['+code+'][0]');
+ this.impl = eval('['+code+'][0]');
}catch(e){
- throw e;
+ this.impl = function(){throw e;};
}
this.config = config;
this.contentType = config.contentType;
View
2 package.json
@@ -1,6 +1,6 @@
{
"name": "lite",
- "version": "3.0.1",
+ "version": "3.0.2",
"description": "A cross platform template engine base on xml/html and javascript expression.",
"keywords": [ "javascript","xhtml","html","Java","PHP","template"],
"author": "jindw <jindw@xidea.org> (http://www.xidea.org)",
View
5 parse/extension-parser.js
@@ -355,9 +355,8 @@ ExtensionParser.prototype = {
var objectMap = {};
var packageObject = require(packageName);
for(var n in packageObject){
- var match = n.match(/^(?:document|xmlns|on|parse|before|seek).*/);
- if(match){
- objectMap = packageObject[n];
+ if(n.match(/^(?:document|xmlns|on|parse|before|seek).*/)){
+ objectMap[n] = packageObject[n];
}
}
}else{
View
1 parse/extension.js
@@ -60,6 +60,7 @@ function appendParser(ext,key,patternKey,fn,o){
Extension.prototype={
initialize:function(objectMap){
+ //console.dir(objectMap)
for(var key in objectMap){
var o = objectMap[key];
// console.error("["+key+"]:"+o+"\n\n")
View
1 parse/parse-context.js
@@ -33,6 +33,7 @@ function ParseContext(config,path){
*/
function initializeParser(context,extensionMap){
var extensionParser = new ExtensionParser();
+ //console.dir(extensionMap)
for(var ns in extensionMap){
var exts = extensionMap[ns];
for(var len = exts.length,i=0;i<len;i++){
View
3 process.js
@@ -74,7 +74,8 @@ function setupCompiler(root,callback){
//process.send({path:path,action:'add',code:result.code,config:result.config,staticPrefix:result[3]})
}catch(e){
callback({path:path,action:'error',
- code:"function(){return "+JSON.stringify(require('util').inspect(e,true))+"}",
+ code:"function(){return '<pre>'+"+JSON.stringify(require('util').inspect(e,true)+
+ '\n\n'+(e.message +e.stack))+"}",
config:{'contentType':'text/html',encoding:'utf-8',error:e}
})
}

0 comments on commit 131f269

Please sign in to comment.
Something went wrong with that request. Please try again.