2018-09-25 12:39:08 +00:00
|
|
|
const UserError = require(`../helpers`).UserError;
|
2018-08-30 09:02:50 +00:00
|
|
|
|
2018-09-18 08:11:51 +00:00
|
|
|
module.exports = 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
|
|
|
};
|