2018-12-27 11:54:16 +00:00
|
|
|
const UserError = require('vn-loopback/util/user-error');
|
2018-09-18 08:11:51 +00:00
|
|
|
|
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
|
|
|
};
|