Slide 15
Slide 15 text
Augmented Errors
Augmented Errors
Errors in Node.js
var appError = require('app-errors');
// ... //
User.prototype.hasPrivilege = function(userId, privilege, cb) {
this.fetchUser(userId, function(err, udo) {
if (!udo) {
var err = new appError.EmptyResultsError('User not found');
err.userId = userId;
cb(err);
return;
}
// ... //
});
};