salix/back/models/agency-workCenter.js

9 lines
285 B
JavaScript
Raw Normal View History

2024-04-26 06:39:05 +00:00
const UserError = require('vn-loopback/util/user-error');
module.exports = Self => {
Self.rewriteDbError(function(err) {
if (err.code === 'ER_DUP_ENTRY')
return new UserError(`This workCenter is already assigned to this agency`);
return err;
});
};