feat: refs #4988 capture error on duplicate
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Pablo Natek 2024-04-25 12:40:54 +02:00
parent c5b02dc239
commit 4e11e46fff
4 changed files with 16 additions and 2 deletions

View File

@ -0,0 +1,8 @@
let UserError = require('vn-loopback/util/user-error');
module.exports = Self => {
Self.rewriteDbError(function(err) {
if (err.code === 'ER_DUP_ENTRY')
return new UserError(`This workCenter is already assigned to this agency`);
return err;
});
};

View File

@ -3787,3 +3787,6 @@ INSERT INTO `vn`.`accountReconciliationConfig`(currencyFk, warehouseFk)
INSERT INTO vn.workerTeam(id, team, workerFk) INSERT INTO vn.workerTeam(id, team, workerFk)
VALUES VALUES
(8, 1, 19); (8, 1, 19);
INSERT INTO vn.workCenter (id, name, payrollCenterFk, counter, warehouseFk, street, geoFk, deliveryManAdjustment)
VALUES(100, 'workCenterOne', 1, NULL, 1, 'gotham', NULL, NULL);

View File

@ -225,5 +225,7 @@
"ticketCommercial": "The ticket {{ ticket }} for the salesperson {{ salesMan }} is in preparation. (automatically generated message)", "ticketCommercial": "The ticket {{ ticket }} for the salesperson {{ salesMan }} is in preparation. (automatically generated message)",
"This password can only be changed by the user themselves": "This password can only be changed by the user themselves", "This password can only be changed by the user themselves": "This password can only be changed by the user themselves",
"They're not your subordinate": "They're not your subordinate", "They're not your subordinate": "They're not your subordinate",
"InvoiceIn is already booked": "InvoiceIn is already booked" "InvoiceIn is already booked": "InvoiceIn is already booked",
"This workCenter already exists": "This workCenter already exists",
"This workCenter is already assigned to this agency": "This workCenter is already assigned to this agency"
} }

View File

@ -353,5 +353,6 @@
"This password can only be changed by the user themselves": "Esta contraseña solo puede ser modificada por el propio usuario", "This password can only be changed by the user themselves": "Esta contraseña solo puede ser modificada por el propio usuario",
"They're not your subordinate": "No es tu subordinado/a.", "They're not your subordinate": "No es tu subordinado/a.",
"No results found": "No se han encontrado resultados", "No results found": "No se han encontrado resultados",
"InvoiceIn is already booked": "La factura recibida está contabilizada" "InvoiceIn is already booked": "La factura recibida está contabilizada",
"This workCenter is already assigned to this agency": "This workCenter is already assigned to this agency"
} }