etapi fix misleading error message

This commit is contained in:
zadam 2022-07-10 22:09:13 +02:00
parent 0c4e5d2a19
commit 5cbcf6e6be
2 changed files with 1 additions and 3 deletions

View File

@ -2,8 +2,6 @@ const becca = require("../becca/becca");
const eu = require("./etapi_utils"); const eu = require("./etapi_utils");
const mappers = require("./mappers"); const mappers = require("./mappers");
const Branch = require("../becca/entities/branch"); const Branch = require("../becca/entities/branch");
const noteService = require("../services/notes");
const TaskContext = require("../services/task_context");
const entityChangesService = require("../services/entity_changes"); const entityChangesService = require("../services/entity_changes");
const v = require("./validators"); const v = require("./validators");

View File

@ -106,7 +106,7 @@ function getAndCheckAttribute(attributeId) {
function validateAndPatch(target, source, allowedProperties) { function validateAndPatch(target, source, allowedProperties) {
for (const key of Object.keys(source)) { for (const key of Object.keys(source)) {
if (!(key in allowedProperties)) { if (!(key in allowedProperties)) {
throw new EtapiError(400, "PROPERTY_NOT_ALLOWED", `Property '${key}' is not allowed for PATCH.`); throw new EtapiError(400, "PROPERTY_NOT_ALLOWED", `Property '${key}' is not allowed for this method.`);
} }
else { else {
for (const validator of allowedProperties[key]) { for (const validator of allowedProperties[key]) {