refs #5929 hotFix: add UserError
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Alex Moreno 2023-08-07 10:04:46 +02:00
parent 83d0a394e3
commit 26d6bbff4c
1 changed files with 3 additions and 6 deletions

View File

@ -1,4 +1,5 @@
const loggable = require('vn-loopback/util/log');
const UserError = require('vn-loopback/util/user-error');
module.exports = Self => {
Self.remoteMethodCtx('componentUpdate', {
@ -112,7 +113,6 @@ module.exports = Self => {
}
try {
const userId = ctx.req.accessToken.userId;
const models = Self.app.models;
const $t = ctx.req.__; // $translate
await models.Ticket.isEditableOrThrow(ctx, args.id, myOptions);
@ -127,11 +127,8 @@ module.exports = Self => {
args.warehouseFk,
myOptions);
if (!zoneShipped || zoneShipped.zoneFk != args.zoneFk) {
const error = `You don't have privileges to change the zone`;
throw new UserError(error);
}
if (!zoneShipped || zoneShipped.zoneFk != args.zoneFk)
throw new UserError(`You don't have privileges to change the zone`);
}
if (args.isWithoutNegatives) {