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

10 lines
259 B
JavaScript
Raw Permalink Normal View History

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