2018-12-27 11:54:16 +00:00
|
|
|
const UserError = require('vn-loopback/util/user-error');
|
2018-08-30 09:02:50 +00:00
|
|
|
|
2018-09-18 08:11:51 +00:00
|
|
|
module.exports = Self => {
|
2024-04-17 11:55:07 +00:00
|
|
|
require('../methods/ticket-observation/addDropOff')(Self);
|
2018-09-18 08:11:51 +00:00
|
|
|
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
|
|
|
};
|