The call of callback function was issued out of try-catch. #8

Open
wants to merge 1 commit into
from

Projects

None yet

1 participant

@tuchida
tuchida commented Dec 30, 2012

Since callback function is called in try-catch, when callback function has a bug, but looked like error in jst.renderFile.

var jst = require('./node-jst/lib/jst.js');
jst.renderFile('test.jst', {}, function(err, res) {
  if (err) {
    console.log('error in jst.renderFile: ' + err);
    return;
  }
  var a = null;
  a.b;   // bug's code
});
error in jst.renderFile: TypeError: Cannot read property 'b' of null

I consider that it is better to call a callback function outside try-catch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment