Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvement of Exception info in File manipulation. #19558

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/private/Files/Node/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function getContent() {
*/
return $this->view->file_get_contents($this->path);
} else {
throw new NotPermittedException();
throw new NotPermittedException('Permission issue unable to get content of file ' . $this->path);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Permission issue unable to get content of file

I don't think so. We don't have permission to read the file.

}
}

Expand All @@ -74,7 +74,7 @@ public function putContent($data) {
$this->fileInfo = null;
$this->sendHooks(array('postWrite'));
} else {
throw new NotPermittedException();
throw new NotPermittedException('Permission issue unable to get content of file ' . $this->path);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't have permission to update a file here. Unable to get content of file is not correct.

}
}

Expand Down Expand Up @@ -115,7 +115,7 @@ public function fopen($mode) {
$this->sendHooks($postHooks);
return $result;
} else {
throw new NotPermittedException();
throw new NotPermittedException('Permission issue Could not open (Incorrect mode ' . $mode . ') ' . $this->path);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The mode is not incorrect. We don't have the required permissions to do that operation. Example: w+ requires us to have read and update permission for a file.

}
}

Expand All @@ -134,7 +134,7 @@ public function delete() {
$this->exists = false;
$this->fileInfo = null;
} else {
throw new NotPermittedException();
throw new NotPermittedException('Permission issue Could not delete file' . $this->path);
}
}

Expand Down