transform exception during file read to sabre exceptions

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2018-04-11 14:45:35 +02:00
parent 7a3ce073da
commit e6a7ddc1c6
1 changed files with 5 additions and 1 deletions

View File

@ -332,7 +332,11 @@ class File extends Node implements IFile {
// do a if the file did not exist
throw new NotFound();
}
$res = $this->fileView->fopen(ltrim($this->path, '/'), 'rb');
try {
$res = $this->fileView->fopen(ltrim($this->path, '/'), 'rb');
} catch (\Exception $e) {
$this->convertToSabreException($e);
}
if ($res === false) {
throw new ServiceUnavailable("Could not open file");
}