salix/modules/item/back/models/genus.js

10 lines
258 B
JavaScript
Raw Permalink Normal View History

2021-03-05 07:45:14 +00:00
let UserError = require('vn-loopback/util/user-error');
2021-03-04 20:30:56 +00:00
2021-03-05 07:45:14 +00:00
module.exports = Self => {
Self.rewriteDbError(function(err) {
if (err.code === 'ER_DUP_ENTRY')
return new UserError(`This genus already exist`);
return err;
2021-03-04 20:30:56 +00:00
});
};