Browse Source

Merge pull request #265 from isocolsky/fix/email_parsing

Improve error check when parsing emails
activeAddress
Matias Alejo Garcia 10 years ago
parent
commit
0e3eeb52ad
  1. 4
      lib/emailservice.js

4
lib/emailservice.js

@ -140,14 +140,16 @@ EmailService.prototype._loadTemplate = function(emailType, recipient, extension,
}; };
EmailService.prototype._applyTemplate = function(template, data, cb) { EmailService.prototype._applyTemplate = function(template, data, cb) {
var error;
var result = _.mapValues(template, function(t) { var result = _.mapValues(template, function(t) {
try { try {
return Mustache.render(t, data); return Mustache.render(t, data);
} catch (e) { } catch (e) {
log.error('Could not apply data to template', e); log.error('Could not apply data to template', e);
return cb(e); error = e;
} }
}); });
if (error) return cb(error);
return cb(null, result); return cb(null, result);
}; };

Loading…
Cancel
Save