salix/modules/ticket/back/models/ticket-observation.js

11 lines
337 B
JavaScript
Raw Permalink Normal View History

2018-12-27 11:54:16 +00:00
const UserError = require('vn-loopback/util/user-error');
2018-08-30 09:02:50 +00:00
module.exports = Self => {
2024-04-17 11:55:07 +00:00
require('../methods/ticket-observation/addDropOff')(Self);
Self.rewriteDbError(function(err) {
if (err.code === 'ER_DUP_ENTRY')
return new UserError(`The observation type can't be repeated`);
return err;
});
2018-03-16 14:06:42 +00:00
};