pop vehicle error
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Carlos Satorres 2023-07-17 13:27:27 +02:00
parent 06690ca71e
commit f24aa2c801
1 changed files with 9 additions and 0 deletions

View File

@ -0,0 +1,9 @@
let UserError = require('vn-loopback/util/user-error');
module.exports = Self => {
Self.rewriteDbError(function(err) {
if (err.code === 'ER_ROW_IS_REFERENCED')
return new UserError(`This invoice has a linked vehicle.`);
return err;
});
};