refs err.sqlMessage
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Carlos Satorres 2023-07-17 14:11:05 +02:00
parent a5d1c68511
commit 52f58a92c8
1 changed files with 1 additions and 2 deletions

View File

@ -10,8 +10,7 @@ module.exports = Self => {
require('../methods/invoice-in/invoiceInEmail')(Self);
require('../methods/invoice-in/getSerial')(Self);
Self.rewriteDbError(function(err) {
console.log(err);
if (err.code === 'ER_ROW_IS_REFERENCED_2')
if (err.code === 'ER_ROW_IS_REFERENCED_2' && err.sqlMessage.includes('vehicleInvoiceIn'))
return new UserError(`This invoice has a linked vehicle.`);
return err;
});