Fix error handling callback

This commit is contained in:
Nick Winter 2015-12-16 13:13:59 -08:00 committed by Rob
parent e1130ff1e8
commit 82ec29247b

View file

@ -249,7 +249,7 @@ module.exports = class Handler
criteria = {}
criteria[if nonVersioned then '_id' else 'original'] = mongoose.Types.ObjectId(id)
@modelClass.findOne(criteria, project).sort(sort).exec (err, document) ->
return done(err) if err
return callback err if err
callback(null, document?.toObject() or null)
funcs = {}