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

wants to merge 1 commit into


None yet

1 participant

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);
  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