Commit 264d89cf authored by catch's avatar catch
Browse files

Issue #3070902 by dalin, mrinalini9, mrupsidown, Bunty Badgujar: Better...

Issue #3070902 by dalin, mrinalini9, mrupsidown, Bunty Badgujar: Better logging for prepareDestination Exception
parent efc85b5a
......@@ -466,10 +466,11 @@ protected function prepareDestination($source, &$destination, $replace) {
// Perhaps $destination is a dir/file?
$dirname = $this->dirname($destination);
if (!$this->prepareDirectory($dirname)) {
$this->logger->error("The specified file '%original_source' could not be copied because the destination directory is not properly configured. This may be caused by a problem with file or directory permissions.", [
$this->logger->error("The specified file '%original_source' could not be copied because the destination directory '%destination_directory' is not properly configured. This may be caused by a problem with file or directory permissions.", [
'%original_source' => $original_source,
'%destination_directory' => $dirname,
]);
throw new DirectoryNotReadyException("The specified file '$original_source' could not be copied because the destination directory is not properly configured. This may be caused by a problem with file or directory permissions.");
throw new DirectoryNotReadyException("The specified file '$original_source' could not be copied because the destination directory '$dirname' is not properly configured. This may be caused by a problem with file or directory permissions.");
}
}
......
......@@ -52,7 +52,7 @@ public function testEnsureFileExistsBeforeCopy() {
*/
public function testDestinationDirectoryFailureOnCopy() {
$this->expectException(DirectoryNotReadyException::class);
$this->expectExceptionMessage("The specified file 'public://test.txt' could not be copied because the destination directory is not properly configured. This may be caused by a problem with file or directory permissions");
$this->expectExceptionMessage("The specified file 'public://test.txt' could not be copied because the destination directory 'public://subdirectory' is not properly configured. This may be caused by a problem with file or directory permissions.");
touch('public://test.txt');
// public://subdirectory has not been created, so \Drupal::service('file_system')->prepareDirectory()
// will fail, causing copy() to throw DirectoryNotReadyException.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment