Skip to content

Commit 0e8560f

Browse files
josefbehrclaude
andcommitted
fix(api): correct misleading error message on empty keyValuePairs
updateQuestion() rejected an empty keyValuePairs array with the message "This form is archived and can not be modified". That message is unrelated to the actual cause and sends callers looking in the wrong place. The sibling methods updateForm() and updateOption() already report this case accurately, and updateQuestion()'s own @throws annotation documents it as "Empty keyValuePairs, will not update" too, so the string looks like a copy-paste leftover from the archived-form check further up. Only the message is changed. The exception type stays OCSBadRequestException so the HTTP status code is unaffected. Signed-off-by: Josef Behr <code@josef-behr.de> Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 892c3d9 commit 0e8560f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

lib/Controller/ApiController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,7 @@ public function updateQuestion(int $formId, int $questionId, array $keyValuePair
675675
// Don't allow empty array
676676
if (count($keyValuePairs) === 0) {
677677
$this->logger->info('Empty keyValuePairs, will not update.');
678-
throw new OCSBadRequestException('This form is archived and can not be modified');
678+
throw new OCSBadRequestException('Empty keyValuePairs, will not update.');
679679
}
680680

681681
//Don't allow to change id or formId

0 commit comments

Comments
 (0)