2019-06-03 07:20:20 +00:00
|
|
|
const UserError = require('vn-loopback/util/user-error');
|
|
|
|
|
|
|
|
module.exports = Self => {
|
2024-09-03 14:50:55 +00:00
|
|
|
require('../methods/device/handle-user')(Self);
|
2019-06-03 07:20:20 +00:00
|
|
|
Self.rewriteDbError(function(err) {
|
|
|
|
if (err.code === 'ER_DUP_ENTRY')
|
|
|
|
return new UserError(``);
|
|
|
|
return err;
|
|
|
|
});
|
|
|
|
};
|