2018-09-18 08:11:51 +00:00
|
|
|
const UserError = require('vn-loopback/common/helpers').UserError;
|
|
|
|
|
2018-05-04 09:46:03 +00:00
|
|
|
module.exports = Self => {
|
2018-09-18 08:11:51 +00:00
|
|
|
Self.rewriteDbError(function(err) {
|
|
|
|
if (err.code === 'ER_DUP_ENTRY')
|
|
|
|
return new UserError(`The warehouse can't be repeated`);
|
|
|
|
return err;
|
2018-08-30 06:50:03 +00:00
|
|
|
});
|
2018-02-20 11:25:51 +00:00
|
|
|
};
|