Problem/Motivation
FileUploadHandler::handleFileUpload() throws FileExistsException when the destination file exists and FileException for an invalid filename. Callers must catch these separately from checking violations on the result object, mixing two error-reporting styles for failures caused by user input.
Steps to reproduce
Proposed resolution
Add getErrors() to FileUploadResult, separate from getViolations(). handleFileUpload() catches FileExistsException and FileException internally and adds them to the result's errors instead of throwing. InvalidStreamWrapperException, FileWriteException, and LockAcquiringException keep throwing, since they reflect misconfiguration or environment failures rather than user input.
Remaining tasks
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
Issue fork drupal-3619417
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #7
kim.pepperThis may have gone out of scope from the original issue summary. I wanted to avoid rendering messages in FormFileUploader, and leave that to calling code.
Comment #8
kim.pepper@nicxvan I had a chat with @amateescu in Rotterdam, and he agrees this kind of change can still go into 12.x beta. If we get it to RTBC I will ping him.
Comment #9
smustgrave commentedThis something that needs a change record the way it's collecting errors now into an array?