salix/modules/invoiceIn/back/models/invoiceInVehicle.js

11 lines
304 B
JavaScript
Raw Normal View History

2023-07-17 11:27:27 +00:00
let UserError = require('vn-loopback/util/user-error');
module.exports = Self => {
Self.rewriteDbError(function(err) {
2023-07-17 12:07:45 +00:00
console.log(err);
2023-07-17 11:51:16 +00:00
if (err.code === 'ER_ROW_IS_REFERENCED_2')
2023-07-17 11:27:27 +00:00
return new UserError(`This invoice has a linked vehicle.`);
return err;
});
};