feat: return sql check error

This commit is contained in:
Alex Moreno 2024-06-26 12:25:18 +02:00
parent 8aea57e8f9
commit cca62ae902
2 changed files with 3 additions and 2 deletions

View File

@ -366,5 +366,6 @@
"It has been invoiced but the PDF could not be generated": "Se ha facturado pero no se ha podido generar el PDF", "It has been invoiced but the PDF could not be generated": "Se ha facturado pero no se ha podido generar el PDF",
"It has been invoiced but the PDF of refund not be generated": "Se ha facturado pero no se ha podido generar el PDF del abono", "It has been invoiced but the PDF of refund not be generated": "Se ha facturado pero no se ha podido generar el PDF del abono",
"Payment method is required": "El método de pago es obligatorio", "Payment method is required": "El método de pago es obligatorio",
"Cannot send mail": "Não é possível enviar o email" "Cannot send mail": "Não é possível enviar o email",
"CONSTRAINT `supplierAccountTooShort` failed for `vn`.`supplier`": "La cuenta debe tener exactamente 10 dígitos"
} }

View File

@ -22,7 +22,7 @@ module.exports = function() {
} }
// MySQL user-defined exceptions // MySQL user-defined exceptions
if (err.sqlState == '45000') if (err.sqlState == '45000' || err?.errno == 4025)
return next(new UserError(req.__(err.sqlMessage))); return next(new UserError(req.__(err.sqlMessage)));
// Logs error to console // Logs error to console