Merge pull request #52800 from nextcloud/debt/noid/simple-file-generic-exception

pull/51667/merge
Kate 2025-05-14 15:25:41 +07:00 committed by GitHub
commit bfa494f247
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 4 deletions

@ -6,9 +6,11 @@
namespace OC\Files\SimpleFS;
use OCP\Files\File;
use OCP\Files\GenericFileException;
use OCP\Files\NotFoundException;
use OCP\Files\NotPermittedException;
use OCP\Files\SimpleFS\ISimpleFile;
use OCP\Lock\LockedException;
class SimpleFile implements ISimpleFile {
private File $file;
@ -48,8 +50,10 @@ class SimpleFile implements ISimpleFile {
/**
* Get the content
*
* @throws NotPermittedException
* @throws GenericFileException
* @throws LockedException
* @throws NotFoundException
* @throws NotPermittedException
*/
public function getContent(): string {
$result = $this->file->getContent();
@ -65,8 +69,10 @@ class SimpleFile implements ISimpleFile {
* Overwrite the file
*
* @param string|resource $data
* @throws NotPermittedException
* @throws GenericFileException
* @throws LockedException
* @throws NotFoundException
* @throws NotPermittedException
*/
public function putContent($data): void {
try {

@ -5,8 +5,10 @@
*/
namespace OCP\Files\SimpleFS;
use OCP\Files\GenericFileException;
use OCP\Files\NotFoundException;
use OCP\Files\NotPermittedException;
use OCP\Lock\LockedException;
/**
* This interface allows to manage simple files.
@ -49,8 +51,10 @@ interface ISimpleFile {
/**
* Get the content
*
* @throws NotPermittedException
* @throws GenericFileException
* @throws LockedException
* @throws NotFoundException
* @throws NotPermittedException
* @since 11.0.0
*/
public function getContent(): string;
@ -59,8 +63,10 @@ interface ISimpleFile {
* Overwrite the file
*
* @param string|resource $data
* @throws NotPermittedException
* @throws GenericFileException
* @throws LockedException
* @throws NotFoundException
* @throws NotPermittedException
* @since 11.0.0
*/
public function putContent($data): void;