node.js - How to get validation errors from specific model when working with transactions? -
right not i'm using code this:
return sequelize .transaction((t) => { return usermodel .update(req.body.user, {where: {userid: usermodel.id}, transaction: t}) .then((u) => passport.upsert(_.extend(req.body.passport, {userid: u.id}), {transaction: t})) }) .then(() => res.flash('success', 'save!')) .catch(sequelize.validationerror, (err) => { res.flash('danger', 'error!'); console.log('errors:', err); });
when error @ 'catch', instance of validationerror don't have reference model. result don't know has errors passport or user.
Comments
Post a Comment