change err and traduction
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Carlos Satorres 2023-07-17 14:07:45 +02:00
parent 10e726c486
commit a5d1c68511
3 changed files with 11 additions and 1 deletions

View File

@ -305,5 +305,6 @@
"The renew period has not been exceeded": "El periodo de renovación no ha sido superado",
"Valid priorities": "Prioridades válidas: %d",
"Negative basis of tickets": "Base negativa para los tickets: {{ticketsIds}}",
"You cannot assign/remove an alias that you are not assigned to": "No puede asignar/eliminar un alias que no tenga asignado"
"You cannot assign/remove an alias that you are not assigned to": "No puede asignar/eliminar un alias que no tenga asignado",
"This invoice has a linked vehicle.": "Esta factura tiene un vehiculo vinculado"
}

View File

@ -1,3 +1,5 @@
const UserError = require('vn-loopback/util/user-error');
module.exports = Self => {
require('../methods/invoice-in/filter')(Self);
require('../methods/invoice-in/summary')(Self);
@ -7,4 +9,10 @@ module.exports = Self => {
require('../methods/invoice-in/invoiceInPdf')(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')
return new UserError(`This invoice has a linked vehicle.`);
return err;
});
};

View File

@ -2,6 +2,7 @@ let UserError = require('vn-loopback/util/user-error');
module.exports = Self => {
Self.rewriteDbError(function(err) {
console.log(err);
if (err.code === 'ER_ROW_IS_REFERENCED_2')
return new UserError(`This invoice has a linked vehicle.`);
return err;